添加工控机测试程序
This commit is contained in:
1
app_ipc_monitoring/.gitignore
vendored
Normal file
1
app_ipc_monitoring/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
57
app_ipc_monitoring/build.gradle
Normal file
57
app_ipc_monitoring/build.gradle
Normal file
@@ -0,0 +1,57 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion "29.0.2"
|
||||
defaultConfig {
|
||||
applicationId "com.zhidao.adas.client"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 22
|
||||
multiDexEnabled true
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
flavorDimensions "multi_device"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
productFlavors {
|
||||
passenger {
|
||||
dimension "multi_device"
|
||||
buildConfigField 'boolean', 'IS_CLIENT', 'true'
|
||||
}
|
||||
driver {
|
||||
dimension "multi_device"
|
||||
buildConfigField 'boolean', 'IS_CLIENT', 'false'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation "com.google.code.gson:gson:2.8.9"
|
||||
implementation project(':libraries:mogo-adas')
|
||||
implementation project(':core:mogo-core-data')
|
||||
// implementation project(':core:mogo-core-utils')
|
||||
// api "com.zhidao.support.adas:high:1.2.1.2_bate21"
|
||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
implementation 'com.mogo.cloud:telematic:1.3.30'
|
||||
}
|
||||
21
app_ipc_monitoring/proguard-rules.pro
vendored
Normal file
21
app_ipc_monitoring/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zhidao.adas.client;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
|
||||
assertEquals("com.zhidao.adas.client", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
57
app_ipc_monitoring/src/main/AndroidManifest.xml
Normal file
57
app_ipc_monitoring/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.adas.client">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.OVERRIDE_WIFI_CONFIG" />
|
||||
<uses-permission android:name="android.permission.READ_CALL_LOG" />
|
||||
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
|
||||
<uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" />
|
||||
<uses-permission android:name="android.permission.USE_SIP" />
|
||||
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <!-- 用于进行网络定位 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 用于访问GPS定位 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:name=".ui.mian.MainActivity"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".ui.autopilot.AutopilotConfigActivity">
|
||||
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.zhidao.adas.client.base;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* RecycleView Adapter
|
||||
* Created by renfeicui on 2018/10/12.
|
||||
*/
|
||||
public abstract class BaseAdapter<D, VH extends BaseViewHolder> extends RecyclerView.Adapter<VH> {
|
||||
protected String TAG = this.getClass().getSimpleName();
|
||||
protected List<D> mDatas;
|
||||
protected Context mContext;
|
||||
private OnItemClickListener<D> mItemClick;
|
||||
|
||||
public interface OnItemClickListener<D> {
|
||||
void onItemClick(int position, D data);
|
||||
}
|
||||
|
||||
|
||||
public BaseAdapter() {
|
||||
}
|
||||
|
||||
public BaseAdapter(List<D> mDatas) {
|
||||
this.mDatas = mDatas;
|
||||
}
|
||||
|
||||
public BaseAdapter(OnItemClickListener<D> listener) {
|
||||
mItemClick = listener;
|
||||
}
|
||||
|
||||
public BaseAdapter(List<D> mDatas, OnItemClickListener<D> listener) {
|
||||
this.mDatas = mDatas;
|
||||
mItemClick = listener;
|
||||
}
|
||||
|
||||
public void setData(List<D> mDatas) {
|
||||
this.mDatas = mDatas;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<D> listener) {
|
||||
mItemClick = listener;
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取制定 位置的Data
|
||||
* @param position 下标
|
||||
* @return Data
|
||||
*/
|
||||
public D getItem(int position) {
|
||||
return mDatas == null ? null : mDatas.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDatas == null ? 0 : mDatas.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull VH viewHolder, int position) {
|
||||
D bean = getItem(position);
|
||||
onBindDataToItem(viewHolder, bean, position);
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public VH onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
|
||||
mContext = viewGroup.getContext();
|
||||
return getViewHolder(getItemViewResource(viewGroup));
|
||||
}
|
||||
|
||||
/***
|
||||
* 同onBindViewHolder()
|
||||
* @param viewHolder viewHolder
|
||||
* @param data 数据
|
||||
* @param position 下标
|
||||
*/
|
||||
protected abstract void onBindDataToItem(VH viewHolder, D data, int position);
|
||||
|
||||
/***
|
||||
* 获取Item布局
|
||||
* @return id
|
||||
*/
|
||||
protected abstract View getItemViewResource(ViewGroup viewGroup);
|
||||
|
||||
/**
|
||||
* 获取ViewHolder
|
||||
*
|
||||
* @param view
|
||||
* @return
|
||||
*/
|
||||
protected abstract VH getViewHolder(View view);
|
||||
|
||||
public void onClick(BaseViewHolder viewHolder) {
|
||||
if (mItemClick != null) {
|
||||
mItemClick.onItemClick(viewHolder.getAdapterPosition(), getItem(viewHolder.getAdapterPosition()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.zhidao.adas.client.base;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
|
||||
public abstract class BaseViewHolder<T extends BaseAdapter> extends RecyclerView.ViewHolder {
|
||||
private T adapter;
|
||||
public View itemView;
|
||||
|
||||
public BaseViewHolder(View itemView, final T adapter) {
|
||||
super(itemView);
|
||||
this.itemView = itemView;
|
||||
this.adapter = adapter;
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
adapter.onClick(BaseViewHolder.this);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class ArrivalNotification extends Base {
|
||||
public final MessagePad.ArrivalNotification bean;
|
||||
|
||||
public ArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ArrivalNotification{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class AutopilotState extends Base {
|
||||
public final MessagePad.AutopilotState bean;
|
||||
|
||||
public AutopilotState(MessagePad.Header header, MessagePad.AutopilotState bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotState{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public abstract class Base {
|
||||
public final MessagePad.Header header;
|
||||
public final int len;
|
||||
|
||||
public Base(int len, MessagePad.Header header) {
|
||||
this.len = 8 + header.getSerializedSize() + len;
|
||||
this.header = header;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + len + "}header=" + header;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class BasicInfoReq extends Base {
|
||||
public final MessagePad.BasicInfoReq bean;
|
||||
|
||||
public BasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BasicInfoReq{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class CarConfigResp extends Base {
|
||||
public final MessagePad.CarConfigResp bean;
|
||||
|
||||
public CarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CarConfigResp{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class GlobalPathResp extends Base {
|
||||
public final MessagePad.GlobalPathResp bean;
|
||||
|
||||
public GlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GlobalPathResp{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class GnssInfo extends Base {
|
||||
public final MessagePad.GnssInfo bean;
|
||||
|
||||
public GnssInfo(MessagePad.Header header, MessagePad.GnssInfo bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GnssInfo{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
public class MogoReportMessage extends Base {
|
||||
public final MogoReportMsg.MogoReportMessage bean;
|
||||
|
||||
public MogoReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoReportMessage{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
public class RecordPanel extends Base {
|
||||
public final RecordPanelOuterClass.RecordPanel bean;
|
||||
|
||||
public RecordPanel(MessagePad.Header header, RecordPanelOuterClass.RecordPanel bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RecordPanel{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class TrackedObjects extends Base {
|
||||
private MessagePad.TrackedObjects bean;
|
||||
|
||||
public TrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TrackedObjects{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class Trajectory extends Base {
|
||||
public final MessagePad.Trajectory bean;
|
||||
|
||||
public Trajectory(MessagePad.Header header, MessagePad.Trajectory bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Trajectory{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import chassis.VehicleStateOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class VehicleState extends Base {
|
||||
public final VehicleStateOuterClass.VehicleState bean;
|
||||
|
||||
public VehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VehicleState{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.zhidao.adas.client.bean;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class Warn extends Base {
|
||||
public final MessagePad.Warn bean;
|
||||
|
||||
public Warn(MessagePad.Header header, MessagePad.Warn bean) {
|
||||
super(bean.getSerializedSize(), header);
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Warn{" + super.toString() +
|
||||
" bean=" + bean +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.zhidao.adas.client.ui.autopilot;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AiCloudToStartAutopilot {
|
||||
|
||||
private String action = "aiCloudToStartAutopilot";
|
||||
public ResultDTO result;
|
||||
|
||||
public static class ResultDTO {
|
||||
public EndLatLonDTO endLatLon;
|
||||
public Integer speedLimit = 20;
|
||||
public StartLatLonDTO startLatLon;
|
||||
public List<WayLatLonsDTO> wayLatLons;
|
||||
|
||||
public static class EndLatLonDTO {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
|
||||
public static class StartLatLonDTO {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
|
||||
public static class WayLatLonsDTO {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
package com.zhidao.adas.client.ui.autopilot;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.adas.client.utils.PreferencesUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class AutopilotConfigActivity extends AppCompatActivity {
|
||||
|
||||
public static void launch(Context context) {
|
||||
Intent intent = new Intent(context,AutopilotConfigActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private Gson gson = new Gson();
|
||||
private EditText start_lon1;
|
||||
private EditText start_lat1;
|
||||
private EditText stop_lon1;
|
||||
private EditText stop_lat1;
|
||||
private EditText t_lon1;
|
||||
private EditText t_lat1;
|
||||
|
||||
private EditText start_lon2;
|
||||
private EditText start_lat2;
|
||||
private EditText stop_lon2;
|
||||
private EditText stop_lat2;
|
||||
private EditText t_lon2;
|
||||
private EditText t_lat2;
|
||||
|
||||
private EditText start_lon3;
|
||||
private EditText start_lat3;
|
||||
private EditText stop_lon3;
|
||||
private EditText stop_lat3;
|
||||
private EditText t_lon3;
|
||||
private EditText t_lat3;
|
||||
|
||||
private EditText start_lon4;
|
||||
private EditText start_lat4;
|
||||
private EditText stop_lon4;
|
||||
private EditText stop_lat4;
|
||||
private EditText t_lon4;
|
||||
private EditText t_lat4;
|
||||
private List<AiCloudToStartAutopilot> list;
|
||||
|
||||
AiCloudToStartAutopilot data1;
|
||||
AiCloudToStartAutopilot data2;
|
||||
AiCloudToStartAutopilot data3;
|
||||
AiCloudToStartAutopilot data4;
|
||||
private String init_all_path = "[\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 26.82355278566775,\n" +
|
||||
" \"lon\": 112.57001723522112\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 26.820319143036112,\n" +
|
||||
" \"lon\": 112.57770688564666\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 40.1979005,\n" +
|
||||
" \"lon\": 116.7261382\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 40.1992337,\n" +
|
||||
" \"lon\": 116.7386131\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 40.1979005,\n" +
|
||||
" \"lon\": 116.7261382\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 40.1992337,\n" +
|
||||
" \"lon\": 116.7386131\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"action\": \"aiCloudToStartAutopilot\",\n" +
|
||||
" \"result\": {\n" +
|
||||
" \"endLatLon\": {\n" +
|
||||
" \"lat\": 40.1979005,\n" +
|
||||
" \"lon\": 116.7261382\n" +
|
||||
" },\n" +
|
||||
" \"speedLimit\": 20,\n" +
|
||||
" \"startLatLon\": {\n" +
|
||||
" \"lat\": 40.1992337,\n" +
|
||||
" \"lon\": 116.7386131\n" +
|
||||
" },\n" +
|
||||
" \"wayLatLons\": [{\n" +
|
||||
" \"lat\": 40.1984044,\n" +
|
||||
" \"lon\": 116.7323222\n" +
|
||||
" }]\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"]";
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_autopilot_cloud_config);
|
||||
start_lon1 = findViewById(R.id.start_lon1);
|
||||
start_lat1 = findViewById(R.id.start_lat1);
|
||||
stop_lon1 = findViewById(R.id.stop_lon1);
|
||||
stop_lat1 = findViewById(R.id.stop_lat1);
|
||||
t_lon1 = findViewById(R.id.t_lon1);
|
||||
t_lat1 = findViewById(R.id.t_lat1);
|
||||
|
||||
start_lon2 = findViewById(R.id.start_lon2);
|
||||
start_lat2 = findViewById(R.id.start_lat2);
|
||||
stop_lon2 = findViewById(R.id.stop_lon2);
|
||||
stop_lat2 = findViewById(R.id.stop_lat2);
|
||||
t_lon2 = findViewById(R.id.t_lon2);
|
||||
t_lat2 = findViewById(R.id.t_lat2);
|
||||
|
||||
start_lon3 = findViewById(R.id.start_lon3);
|
||||
start_lat3 = findViewById(R.id.start_lat3);
|
||||
stop_lon3 = findViewById(R.id.stop_lon3);
|
||||
stop_lat3 = findViewById(R.id.stop_lat3);
|
||||
t_lon3 = findViewById(R.id.t_lon3);
|
||||
t_lat3 = findViewById(R.id.t_lat3);
|
||||
|
||||
start_lon4 = findViewById(R.id.start_lon4);
|
||||
start_lat4 = findViewById(R.id.start_lat4);
|
||||
stop_lon4 = findViewById(R.id.stop_lon4);
|
||||
stop_lat4 = findViewById(R.id.stop_lat4);
|
||||
t_lon4 = findViewById(R.id.t_lon4);
|
||||
t_lat4 = findViewById(R.id.t_lat4);
|
||||
//开始执行
|
||||
final Button button = findViewById(R.id.start);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String json = PreferencesUtils.getString(AutopilotConfigActivity.this, Constants.SEL_PATH, null);
|
||||
if (TextUtils.isEmpty(json)) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "请先选择路线", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
json = json.split("##")[1];
|
||||
Log.i("开始执行自动驾驶", json);
|
||||
AdasManager.getInstance().aiCloudToAdasData(json);
|
||||
}
|
||||
});
|
||||
findViewById(R.id.save).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
data1.result.startLatLon.lon = Double.parseDouble(start_lon1.getText().toString().trim());
|
||||
data1.result.startLatLon.lat = Double.parseDouble(start_lat1.getText().toString().trim());
|
||||
data1.result.endLatLon.lon = Double.parseDouble(stop_lon1.getText().toString().trim());
|
||||
data1.result.endLatLon.lat = Double.parseDouble(stop_lat1.getText().toString().trim());
|
||||
data1.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon1.getText().toString().trim());
|
||||
data1.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat1.getText().toString().trim());
|
||||
|
||||
|
||||
data2.result.startLatLon.lon = Double.parseDouble(start_lon2.getText().toString().trim());
|
||||
data2.result.startLatLon.lat = Double.parseDouble(start_lat2.getText().toString().trim());
|
||||
data2.result.endLatLon.lon = Double.parseDouble(stop_lon2.getText().toString().trim());
|
||||
data2.result.endLatLon.lat = Double.parseDouble(stop_lat2.getText().toString().trim());
|
||||
data2.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon2.getText().toString().trim());
|
||||
data2.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat2.getText().toString().trim());
|
||||
|
||||
|
||||
data3.result.startLatLon.lon = Double.parseDouble(start_lon3.getText().toString().trim());
|
||||
data3.result.startLatLon.lat = Double.parseDouble(start_lat3.getText().toString().trim());
|
||||
data3.result.endLatLon.lon = Double.parseDouble(stop_lon3.getText().toString().trim());
|
||||
data3.result.endLatLon.lat = Double.parseDouble(stop_lat3.getText().toString().trim());
|
||||
data3.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon3.getText().toString().trim());
|
||||
data3.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat3.getText().toString().trim());
|
||||
|
||||
|
||||
data4.result.startLatLon.lon = Double.parseDouble(start_lon4.getText().toString().trim());
|
||||
data4.result.startLatLon.lat = Double.parseDouble(start_lat4.getText().toString().trim());
|
||||
data4.result.endLatLon.lon = Double.parseDouble(stop_lon4.getText().toString().trim());
|
||||
data4.result.endLatLon.lat = Double.parseDouble(stop_lat4.getText().toString().trim());
|
||||
data4.result.wayLatLons.get(0).lon = Double.parseDouble(t_lon4.getText().toString().trim());
|
||||
data4.result.wayLatLons.get(0).lat = Double.parseDouble(t_lat4.getText().toString().trim());
|
||||
|
||||
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.ALL_PATH, gson.toJson(list));
|
||||
}
|
||||
});
|
||||
View path1 = findViewById(R.id.path1);
|
||||
View path2 = findViewById(R.id.path2);
|
||||
View path3 = findViewById(R.id.path3);
|
||||
View path4 = findViewById(R.id.path4);
|
||||
path1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线1", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "1##" + gson.toJson(list.get(0)));
|
||||
button.setText("开始执行自动驾驶(路线1)");
|
||||
}
|
||||
});
|
||||
path2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线2", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "2##" + gson.toJson(list.get(1)));
|
||||
button.setText("开始执行自动驾驶(路线2)");
|
||||
}
|
||||
});
|
||||
path3.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线3", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "3##" + gson.toJson(list.get(2)));
|
||||
button.setText("开始执行自动驾驶(路线3)");
|
||||
}
|
||||
});
|
||||
path4.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(AutopilotConfigActivity.this, "已设置路线4", Toast.LENGTH_SHORT).show();
|
||||
PreferencesUtils.putString(AutopilotConfigActivity.this, Constants.SEL_PATH, "4##" + gson.toJson(list.get(3)));
|
||||
button.setText("开始执行自动驾驶(路线4)");
|
||||
}
|
||||
});
|
||||
|
||||
String allPath = PreferencesUtils.getString(AutopilotConfigActivity.this, Constants.ALL_PATH, init_all_path);
|
||||
list = gson.fromJson(allPath, new TypeToken<List<AiCloudToStartAutopilot>>() {
|
||||
}.getType());
|
||||
data1 = list.get(0);
|
||||
data2 = list.get(1);
|
||||
data3 = list.get(2);
|
||||
data4 = list.get(3);
|
||||
start_lon1.setText(String.valueOf(data1.result.startLatLon.lon));
|
||||
start_lat1.setText(String.valueOf(data1.result.startLatLon.lat));
|
||||
stop_lon1.setText(String.valueOf(data1.result.endLatLon.lon));
|
||||
stop_lat1.setText(String.valueOf(data1.result.endLatLon.lat));
|
||||
t_lon1.setText(String.valueOf(data1.result.wayLatLons.get(0).lon));
|
||||
t_lat1.setText(String.valueOf(data1.result.wayLatLons.get(0).lat));
|
||||
|
||||
start_lon2.setText(String.valueOf(data2.result.startLatLon.lon));
|
||||
start_lat2.setText(String.valueOf(data2.result.startLatLon.lat));
|
||||
stop_lon2.setText(String.valueOf(data2.result.endLatLon.lon));
|
||||
stop_lat2.setText(String.valueOf(data2.result.endLatLon.lat));
|
||||
t_lon2.setText(String.valueOf(data2.result.wayLatLons.get(0).lon));
|
||||
t_lat2.setText(String.valueOf(data2.result.wayLatLons.get(0).lat));
|
||||
|
||||
start_lon3.setText(String.valueOf(data3.result.startLatLon.lon));
|
||||
start_lat3.setText(String.valueOf(data3.result.startLatLon.lat));
|
||||
stop_lon3.setText(String.valueOf(data3.result.endLatLon.lon));
|
||||
stop_lat3.setText(String.valueOf(data3.result.endLatLon.lat));
|
||||
t_lon3.setText(String.valueOf(data3.result.wayLatLons.get(0).lon));
|
||||
t_lat3.setText(String.valueOf(data3.result.wayLatLons.get(0).lat));
|
||||
|
||||
start_lon4.setText(String.valueOf(data4.result.startLatLon.lon));
|
||||
start_lat4.setText(String.valueOf(data4.result.startLatLon.lat));
|
||||
stop_lon4.setText(String.valueOf(data4.result.endLatLon.lon));
|
||||
stop_lat4.setText(String.valueOf(data4.result.endLatLon.lat));
|
||||
t_lon4.setText(String.valueOf(data4.result.wayLatLons.get(0).lon));
|
||||
t_lat4.setText(String.valueOf(data4.result.wayLatLons.get(0).lat));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.base.BaseViewHolder;
|
||||
|
||||
|
||||
//log所用
|
||||
public class DataShowAdapter extends BaseAdapter<LogModel, DataShowAdapter.ViewHolder> {
|
||||
|
||||
|
||||
public void refreshView(int position) {
|
||||
if (position == -1) {
|
||||
notifyDataSetChanged();
|
||||
} else {
|
||||
notifyItemInserted(position);
|
||||
}
|
||||
// notifyDataSetChanged();
|
||||
// L.i(TAG, "position=" + position);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void onBindDataToItem(ViewHolder viewHolder, LogModel data, int position) {
|
||||
viewHolder.id.setText("[" + data.data.length() + "]" + (position + 1) + ". ");
|
||||
viewHolder.editText.setTextColor(viewHolder.editText.getResources().getColor(data.getColor()));
|
||||
viewHolder.editText.setText(data.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getItemViewResource(ViewGroup viewGroup) {
|
||||
return LayoutInflater.from(mContext).inflate(R.layout.item_log_info, viewGroup, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ViewHolder getViewHolder(View view) {
|
||||
return new ViewHolder(view, this);
|
||||
}
|
||||
|
||||
|
||||
class ViewHolder extends BaseViewHolder<DataShowAdapter> {
|
||||
EditText editText;
|
||||
TextView id;
|
||||
|
||||
public ViewHolder(View itemView, DataShowAdapter adapter) {
|
||||
super(itemView, adapter);
|
||||
editText =itemView.findViewById(R.id.log);
|
||||
id =itemView.findViewById(R.id.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.GlobalPathResp;
|
||||
import com.zhidao.adas.client.bean.GnssInfo;
|
||||
import com.zhidao.adas.client.bean.RecordPanel;
|
||||
import com.zhidao.adas.client.bean.TrackedObjects;
|
||||
import com.zhidao.adas.client.bean.Trajectory;
|
||||
import com.zhidao.adas.client.bean.VehicleState;
|
||||
import com.zhidao.adas.client.bean.Warn;
|
||||
import com.zhidao.adas.client.utils.MyLinearLayoutManager;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.msg.ReportMessage;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/8/16
|
||||
*/
|
||||
public class InfoFragment extends Fragment {
|
||||
|
||||
private String title;
|
||||
private List<LogModel> data = new ArrayList<>();
|
||||
private DataShowAdapter adapter;
|
||||
|
||||
public InfoFragment() {
|
||||
}
|
||||
|
||||
public InfoFragment(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_info, container, false);
|
||||
initView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
private TextView tvTitle;
|
||||
private RecyclerView rvInfo;
|
||||
|
||||
private void initView(View view) {
|
||||
tvTitle = view.findViewById(R.id.tv_title);
|
||||
rvInfo = view.findViewById(R.id.rv_info);
|
||||
|
||||
CupidLogUtils.w("InfoFragment===>" + title);
|
||||
tvTitle.setText(title);
|
||||
tvTitle.setGravity(Gravity.CENTER);
|
||||
//创建默认的线性LayoutManager 横向的GridLayoutManager
|
||||
MyLinearLayoutManager linearLayoutManager = new MyLinearLayoutManager(this.getContext());
|
||||
linearLayoutManager.setStackFromEnd(true);//列表再底部开始展示,反转后由上面开始展示
|
||||
linearLayoutManager.setReverseLayout(true);//列表翻转
|
||||
rvInfo.setLayoutManager(linearLayoutManager);
|
||||
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
|
||||
rvInfo.setHasFixedSize(false);
|
||||
rvInfo.setNestedScrollingEnabled(false);
|
||||
adapter = new DataShowAdapter();
|
||||
adapter.setData(data);
|
||||
rvInfo.setAdapter(adapter);
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onWarnEvent(Warn info) {
|
||||
if (title.equals("预警数据")) {
|
||||
if (data.size() > 19) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onRectEvent(TrackedObjects info) {
|
||||
if (title.equals("感知数据")) {
|
||||
if (data.size() > 4) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void onTurnLightState(int turnLight, boolean brake_light) {
|
||||
StringBuilder builder = new StringBuilder("底盘数据\t");
|
||||
if (turnLight == 0) {
|
||||
builder.append("左转:关");
|
||||
builder.append("右转:关");
|
||||
} else if (turnLight == 1) {
|
||||
builder.append("左转:开");
|
||||
builder.append("右转:关");
|
||||
} else if (turnLight == 2) {
|
||||
builder.append("左转:关");
|
||||
builder.append("右转:开");
|
||||
}
|
||||
|
||||
builder.append(brake_light ? " 刹车:开" : " 刹车:关");
|
||||
tvTitle.setText(builder.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析转向灯
|
||||
*/
|
||||
private int turnLightTimes = 0;
|
||||
private boolean isOnTurnLight = false;
|
||||
private int turnLight = 0;
|
||||
|
||||
public int setTurnLightState(int turn_light) {
|
||||
if (turn_light == 0) {
|
||||
if (isOnTurnLight) {
|
||||
if (turnLightTimes >= 10) {
|
||||
isOnTurnLight = false;
|
||||
turnLight = 0;
|
||||
}
|
||||
turnLightTimes++;
|
||||
}
|
||||
} else if (turn_light == 1) {
|
||||
turnLightTimes = 0;
|
||||
isOnTurnLight = true;
|
||||
turnLight = 1;
|
||||
} else if (turn_light == 2) {
|
||||
turnLightTimes = 0;
|
||||
isOnTurnLight = true;
|
||||
turnLight = 2;
|
||||
}
|
||||
return turnLight;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onCarEvent(VehicleState info) {
|
||||
if (title.equals("底盘数据")) {
|
||||
if (data.size() > 5) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
adapter.notifyDataSetChanged();
|
||||
int light = info.bean.getLight().getNumber();//转向灯状态 0是正常 1是左转 2是右转
|
||||
onTurnLightState(setTurnLightState(light), info.bean.getBrake_light());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutoEvent(GnssInfo info) {
|
||||
if (title.equals("GNSS数据")) {
|
||||
if (data.size() > 9) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutoEvent(AutopilotState info) {
|
||||
if (title.equals("自动驾驶状态")) {
|
||||
if (data.size() > 9) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onTrajectoryEvent(Trajectory info) {
|
||||
if (title.equals("局部轨迹")) {
|
||||
if (data.size() > 9) {
|
||||
data.remove(0);
|
||||
}
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotWayArriveEvent(ArrivalNotification info) {
|
||||
if (title.equals("自动驾驶站点")) {
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotRouteEvent(GlobalPathResp info) {
|
||||
if (title.equals("自动驾驶路径")) {
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotRecordResultEvent(RecordPanel info) {
|
||||
if (title.equals("BadCase数据")) {
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onAutopilotGuardianInfoEvent(ReportMessage info) {
|
||||
if (title.equals("监控事件报告")) {
|
||||
data.add(new LogModel(LogModel.ACTION.RECEIVE, info.toString()));
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.base.BaseViewHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/8/13
|
||||
*/
|
||||
public class InfoTitleAdapter extends BaseAdapter<String, InfoTitleAdapter.ViewHolder> {
|
||||
private int selectedPosition = 0;//当前选中的下标
|
||||
private boolean isFragment = false;
|
||||
|
||||
public void setSelectedPosition(int position) {
|
||||
if (position != selectedPosition) {
|
||||
notifyItemChanged(position);
|
||||
notifyItemChanged(selectedPosition);
|
||||
selectedPosition = position;
|
||||
}
|
||||
}
|
||||
public InfoTitleAdapter(List<String> data, boolean isFragment) {
|
||||
super(data);
|
||||
this.isFragment = isFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBindDataToItem(ViewHolder viewHolder, String data, int position) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
if (isFragment){
|
||||
viewHolder.itemView.setSelected(selectedPosition == position);
|
||||
}
|
||||
viewHolder.title.setText(data);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected View getItemViewResource(ViewGroup viewGroup) {
|
||||
return LayoutInflater.from(mContext).inflate(R.layout.item_info, viewGroup, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ViewHolder getViewHolder(View view) {
|
||||
return new ViewHolder(view, this);
|
||||
}
|
||||
|
||||
class ViewHolder extends BaseViewHolder<InfoTitleAdapter> {
|
||||
TextView title;
|
||||
|
||||
public ViewHolder(View itemView, InfoTitleAdapter adapter) {
|
||||
super(itemView, adapter);
|
||||
title = itemView.findViewById(R.id.tv_info_title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
|
||||
|
||||
//保存的log
|
||||
public class LogModel {
|
||||
|
||||
public interface ACTION {
|
||||
String SEND = "发送";
|
||||
String RECEIVE = "接收";
|
||||
String PARSE = "解析";
|
||||
}
|
||||
|
||||
public long id;
|
||||
public String action;//log标签
|
||||
public String data;//log数据
|
||||
public String time;
|
||||
|
||||
public LogModel() {
|
||||
}
|
||||
|
||||
public LogModel(String action, String data) {
|
||||
this.action = action;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
public int getColor() {
|
||||
switch (action) {
|
||||
case ACTION.SEND:
|
||||
return R.color.colorAccent;
|
||||
case ACTION.RECEIVE:
|
||||
return R.color.colorPrimary;
|
||||
case ACTION.PARSE:
|
||||
return Color.parseColor("#228B22");
|
||||
default:
|
||||
return Color.parseColor("#871f78");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return data+"";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,910 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import static com.mogo.telematic.MogoProtocolMsg.NORMAL_DATA;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.telematic.MogoProtocolMsg;
|
||||
import com.mogo.telematic.NSDNettyManager;
|
||||
import com.mogo.telematic.client.listener.NettyClientListener;
|
||||
import com.mogo.telematic.client.status.ConnectState;
|
||||
import com.mogo.telematic.server.netty.NettyServerListener;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.base.BaseAdapter;
|
||||
import com.zhidao.adas.client.bean.ArrivalNotification;
|
||||
import com.zhidao.adas.client.bean.AutopilotState;
|
||||
import com.zhidao.adas.client.bean.BasicInfoReq;
|
||||
import com.zhidao.adas.client.bean.CarConfigResp;
|
||||
import com.zhidao.adas.client.bean.GlobalPathResp;
|
||||
import com.zhidao.adas.client.bean.GnssInfo;
|
||||
import com.zhidao.adas.client.bean.MogoReportMessage;
|
||||
import com.zhidao.adas.client.bean.RecordPanel;
|
||||
import com.zhidao.adas.client.bean.TrackedObjects;
|
||||
import com.zhidao.adas.client.bean.Trajectory;
|
||||
import com.zhidao.adas.client.bean.VehicleState;
|
||||
import com.zhidao.adas.client.bean.Warn;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.AdasOptions;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.OnAdasConnectStatusListener;
|
||||
import com.zhidao.support.adas.high.OnMultiDeviceListener;
|
||||
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.SSHResult;
|
||||
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.recorder.RecordDataManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import chassis.VehicleStateOuterClass;
|
||||
import io.netty.channel.Channel;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements OnAdasListener, OnAdasConnectStatusListener, BaseAdapter.OnItemClickListener<String> {
|
||||
private final static String TAG = MainActivity.class.getSimpleName();
|
||||
private EditText etIp;
|
||||
private TextView role;
|
||||
private TextView tvIp;
|
||||
private TextView title;
|
||||
private TextView ipcIp;
|
||||
private TextView localIp;
|
||||
private View line;
|
||||
private RadioGroup connectionType;
|
||||
private AppCompatButton connect;
|
||||
private AppCompatButton disconnect;
|
||||
private RadioButton fixation;
|
||||
private RadioButton assign;
|
||||
private Switch switchLog;
|
||||
private RecyclerView infoBtn;
|
||||
private RecyclerView infoFragment;
|
||||
private TextView tvConnectState;
|
||||
private ScheduledExecutorService mExecutorServiceConfigTimer;
|
||||
private Gson gson;
|
||||
|
||||
|
||||
private final List<String> titleFragmentData = new ArrayList<>();
|
||||
private final List<String> titleBtnData = new ArrayList<>();
|
||||
|
||||
private InfoTitleAdapter btnAdapter;
|
||||
private InfoTitleAdapter fragmentAdapter;
|
||||
|
||||
private InfoFragment carFragment;
|
||||
private InfoFragment viewFragment;
|
||||
private InfoFragment canFragment;
|
||||
private InfoFragment autoFragment;
|
||||
private InfoFragment warnFragment;
|
||||
private InfoFragment trajectoryFragment;
|
||||
private InfoFragment autopilotWayArriveFragment;
|
||||
private InfoFragment autopilotRouteFragment;
|
||||
private UpgradeFragment upgradeFragment;
|
||||
private InfoFragment badcseFragment;
|
||||
private InfoFragment reportMessageFragment;
|
||||
private VersionFragment versionFragment;
|
||||
private FragmentManager manager;
|
||||
private FragmentTransaction transaction;
|
||||
private String ftpTime;
|
||||
private boolean isPad;
|
||||
private String recordKey;
|
||||
private String recordFileName;
|
||||
private int connectStatus;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
isPad = isPad(this);
|
||||
if (!isPad)
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
initView();
|
||||
firstFragment();
|
||||
gson = new Gson();
|
||||
initAdas();
|
||||
connectStatus = AdasManager.getInstance().getIpcConnectionStatus();
|
||||
onUpdateConnectStateView();
|
||||
showIPCIP(AdasManager.getInstance().getIpcConnectedIp(), AdasManager.getInstance().getIpcConnectedPort());
|
||||
}
|
||||
|
||||
|
||||
private void connect(boolean isConnect) {
|
||||
if (isConnect) {
|
||||
switch (Constants.getIpcConnectionMode(this)) {
|
||||
case AdasOptions.IPC_CONNECTION_MODE.FIXATION:
|
||||
AdasManager.getInstance().getAdasOptions().setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(this));
|
||||
break;
|
||||
case AdasOptions.IPC_CONNECTION_MODE.ASSIGN:
|
||||
String ip = etIp.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(ip)) {
|
||||
Toast.makeText(this, "请输入指定IP", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
AdasManager.getInstance().getAdasOptions().setIpcAssignIP(ip);
|
||||
break;
|
||||
}
|
||||
AdasManager.getInstance().getAdasOptions().setIpcConnectionMode(Constants.getIpcConnectionMode(this));
|
||||
AdasManager.getInstance().connect();
|
||||
} else
|
||||
AdasManager.getInstance().disconnect();
|
||||
}
|
||||
|
||||
|
||||
private void initView() {
|
||||
etIp = findViewById(R.id.et_ip);
|
||||
role = findViewById(R.id.role);
|
||||
line = findViewById(R.id.line);
|
||||
connectionType = findViewById(R.id.connection_type);
|
||||
tvIp = findViewById(R.id.tv_ip);
|
||||
connect = findViewById(R.id.connect);
|
||||
disconnect = findViewById(R.id.disconnect);
|
||||
fixation = findViewById(R.id.fixation);
|
||||
assign = findViewById(R.id.assign);
|
||||
switchLog = findViewById(R.id.switch_log);
|
||||
title = findViewById(R.id.title);
|
||||
infoBtn = findViewById(R.id.info_btn);
|
||||
infoFragment = findViewById(R.id.info_fragment);
|
||||
tvConnectState = findViewById(R.id.tv_connect_state);
|
||||
ipcIp = findViewById(R.id.ipc_ip);
|
||||
localIp = findViewById(R.id.local_ip);
|
||||
|
||||
|
||||
role.setText(BuildConfig.IS_CLIENT ? "乘客" : "司机");
|
||||
if (BuildConfig.IS_CLIENT) {
|
||||
line.setVisibility(View.GONE);
|
||||
connectionType.setVisibility(View.GONE);
|
||||
etIp.setVisibility(View.GONE);
|
||||
tvIp.setVisibility(View.GONE);
|
||||
line.setVisibility(View.GONE);
|
||||
connect.setVisibility(View.GONE);
|
||||
disconnect.setVisibility(View.GONE);
|
||||
}
|
||||
connect.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
connect(true);
|
||||
}
|
||||
});
|
||||
disconnect.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
connect(false);
|
||||
}
|
||||
});
|
||||
initListData();
|
||||
initBtnRecyclerView();
|
||||
initFragmentRecyclerView();
|
||||
switch (Constants.getIpcConnectionMode(this)) {
|
||||
case 0:
|
||||
fixation.setChecked(true);
|
||||
break;
|
||||
case 1:
|
||||
assign.setChecked(true);
|
||||
break;
|
||||
|
||||
}
|
||||
String ip = Constants.getIPCIp(this);
|
||||
if (!TextUtils.isEmpty(ip))
|
||||
etIp.setText(ip);
|
||||
// infoTitleList.add("录音测试");
|
||||
//初始化fragment
|
||||
manager = getSupportFragmentManager();
|
||||
transaction = manager.beginTransaction();
|
||||
|
||||
|
||||
switchLog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
if (b) {
|
||||
AdasManager.getInstance().setEnableLog(true);
|
||||
switchLog.setText("日志:开");
|
||||
|
||||
} else {
|
||||
AdasManager.getInstance().setEnableLog(false);
|
||||
switchLog.setText("日志:关");
|
||||
}
|
||||
}
|
||||
});
|
||||
connectionType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
int type;
|
||||
switch (checkedId) {
|
||||
default:
|
||||
|
||||
case R.id.assign:
|
||||
type = AdasOptions.IPC_CONNECTION_MODE.ASSIGN;
|
||||
break;
|
||||
case R.id.fixation:
|
||||
type = AdasOptions.IPC_CONNECTION_MODE.FIXATION;
|
||||
break;
|
||||
}
|
||||
Constants.setIpcConnectionMode(MainActivity.this, type);
|
||||
}
|
||||
});
|
||||
etIp.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (TextUtils.isEmpty(s)) {
|
||||
Constants.delIPCIp(MainActivity.this);
|
||||
} else {
|
||||
Constants.setIPCIp(MainActivity.this, s.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
});
|
||||
showLocalIP();
|
||||
title.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showLocalIP();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initListData() {
|
||||
titleFragmentData.add("GNSS数据");
|
||||
titleFragmentData.add("底盘数据");
|
||||
titleFragmentData.add("感知数据");
|
||||
titleFragmentData.add("自动驾驶状态");
|
||||
titleFragmentData.add("预警数据");
|
||||
titleFragmentData.add("局部轨迹");
|
||||
titleFragmentData.add("自动驾驶站点");
|
||||
titleFragmentData.add("自动驾驶路径");
|
||||
titleFragmentData.add("IPC升级");
|
||||
titleFragmentData.add("BadCase数据");
|
||||
titleFragmentData.add("监控事件报告");
|
||||
titleFragmentData.add("版本和配置");
|
||||
|
||||
titleBtnData.add("下发站点1");
|
||||
titleBtnData.add("下发站点2");
|
||||
titleBtnData.add("自动驾驶路径查询");
|
||||
titleBtnData.add("下发SN");
|
||||
titleBtnData.add("数据采集5秒");
|
||||
titleBtnData.add("数据采集start");
|
||||
titleBtnData.add("数据采集end");
|
||||
titleBtnData.add("发送信号灯");
|
||||
titleBtnData.add("速度设置");
|
||||
titleBtnData.add("重启Docker");
|
||||
titleBtnData.add("重启IPC");
|
||||
titleBtnData.add("关机");
|
||||
titleBtnData.add("采集类型");
|
||||
titleBtnData.add("打开演示模式");
|
||||
titleBtnData.add("关闭演示模式");
|
||||
}
|
||||
|
||||
private void initBtnRecyclerView() {
|
||||
//初始info-recycle
|
||||
GridLayoutManager nodLinearLayoutManage = new GridLayoutManager(this, 2);
|
||||
nodLinearLayoutManage.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
infoBtn.setLayoutManager(nodLinearLayoutManage);
|
||||
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
|
||||
infoBtn.setHasFixedSize(true);
|
||||
//解决局部刷新闪屏问题
|
||||
SimpleItemAnimator animatorInfo = (SimpleItemAnimator) infoBtn.getItemAnimator();
|
||||
if (animatorInfo != null)
|
||||
animatorInfo.setSupportsChangeAnimations(false);
|
||||
//创建并设置Adapter
|
||||
btnAdapter = new InfoTitleAdapter(titleBtnData, false);
|
||||
infoBtn.setAdapter(btnAdapter);
|
||||
btnAdapter.setOnItemClickListener(this);
|
||||
}
|
||||
|
||||
private void initFragmentRecyclerView() {
|
||||
//创建默认的线性LayoutManager 横向的GridLayoutManager
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
infoFragment.setLayoutManager(linearLayoutManager);
|
||||
//如果可以确定每个item的高度是固定的,设置这个选项可以提高性能
|
||||
infoFragment.setHasFixedSize(true);
|
||||
//解决局部刷新闪屏问题
|
||||
SimpleItemAnimator animator = (SimpleItemAnimator) infoFragment.getItemAnimator();
|
||||
if (animator != null)
|
||||
animator.setSupportsChangeAnimations(false);
|
||||
//创建并设置Adapter
|
||||
fragmentAdapter = new InfoTitleAdapter(titleFragmentData, true);
|
||||
infoFragment.setAdapter(fragmentAdapter);
|
||||
fragmentAdapter.setOnItemClickListener(new BaseAdapter.OnItemClickListener<String>() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(int position, String data) {
|
||||
fragmentAdapter.setSelectedPosition(position);
|
||||
manager = getSupportFragmentManager();
|
||||
transaction = manager.beginTransaction();
|
||||
CupidLogUtils.w(TAG, "TitleAdapter===>name:" + data);
|
||||
switch (data) {
|
||||
case "GNSS数据":
|
||||
firstFragment();
|
||||
break;
|
||||
case "底盘数据":
|
||||
if (canFragment == null)
|
||||
canFragment = new InfoFragment(data);
|
||||
if (!viewFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, canFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "感知数据":
|
||||
if (viewFragment == null)
|
||||
viewFragment = new InfoFragment(data);
|
||||
if (!viewFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, viewFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "自动驾驶状态":
|
||||
if (autoFragment == null)
|
||||
autoFragment = new InfoFragment(data);
|
||||
if (!autoFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, autoFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "预警数据":
|
||||
if (warnFragment == null)
|
||||
warnFragment = new InfoFragment(data);
|
||||
if (!warnFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, warnFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "局部轨迹":
|
||||
if (trajectoryFragment == null)
|
||||
trajectoryFragment = new InfoFragment(data);
|
||||
if (!trajectoryFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, trajectoryFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "自动驾驶站点":
|
||||
if (autopilotWayArriveFragment == null)
|
||||
autopilotWayArriveFragment = new InfoFragment(data);
|
||||
if (!autopilotWayArriveFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, autopilotWayArriveFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "自动驾驶路径":
|
||||
if (autopilotRouteFragment == null)
|
||||
autopilotRouteFragment = new InfoFragment(data);
|
||||
if (!autopilotRouteFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, autopilotRouteFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "IPC升级":
|
||||
if (upgradeFragment == null)
|
||||
upgradeFragment = new UpgradeFragment(data);
|
||||
if (!upgradeFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, upgradeFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "BadCase数据":
|
||||
if (badcseFragment == null)
|
||||
badcseFragment = new InfoFragment(data);
|
||||
if (!badcseFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, badcseFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "监控事件报告":
|
||||
if (reportMessageFragment == null)
|
||||
reportMessageFragment = new InfoFragment(data);
|
||||
if (!reportMessageFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, reportMessageFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
case "版本和配置":
|
||||
AdasManager.getInstance().sendCarConfigReq();
|
||||
if (versionFragment == null)
|
||||
versionFragment = new VersionFragment("工控机版本\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t固定IP配置");
|
||||
if (!versionFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, versionFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void showIPCIP(String ip, int port) {
|
||||
if (!BuildConfig.IS_CLIENT) {
|
||||
ipcIp.setVisibility(View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(ip)) {
|
||||
ip = "IPC IP:" + ip + ":" + port;
|
||||
}
|
||||
ipcIp.setText(ip);
|
||||
} else {
|
||||
ipcIp.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onUpdateConnectStateView() {
|
||||
String status;
|
||||
int color;
|
||||
switch (connectStatus) {
|
||||
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTED:
|
||||
status = "已连接";
|
||||
color = R.color.connect_status_connected;
|
||||
break;
|
||||
default:
|
||||
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED:
|
||||
status = "未连接";
|
||||
color = R.color.connect_status_disconnected;
|
||||
break;
|
||||
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTING:
|
||||
status = "连接中";
|
||||
color = R.color.connect_status_connecting;
|
||||
break;
|
||||
|
||||
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.SEARCH_ADDRESS:
|
||||
status = "搜索IP";
|
||||
color = R.color.connect_status_search_address;
|
||||
break;
|
||||
case com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS:
|
||||
status = "未找到";
|
||||
color = R.color.connect_status_disconnecting;
|
||||
break;
|
||||
}
|
||||
CupidLogUtils.i(TAG, "connectStatus=" + status);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tvConnectState.setText(status);
|
||||
tvConnectState.setTextColor(getResources().getColor(color));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void updateText(final TextView tv, final String text) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tv.setText(text);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSSHResult(final SSHResult info) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showToastCenter("IPC命令下发结果:" + info.code + " 命令:" + info.cmd + " 信息:" + info.msg);
|
||||
}
|
||||
});
|
||||
CupidLogUtils.w(TAG, "IPC命令下发结果:" + info.code + " 命令:" + info.cmd + " 信息:" + info.msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory) {
|
||||
EventBus.getDefault().postSticky(new Trajectory(header, trajectory));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects) {
|
||||
EventBus.getDefault().postSticky(new TrackedObjects(header, trackedObjects));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo) {
|
||||
EventBus.getDefault().postSticky(new GnssInfo(header, gnssInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState) {
|
||||
EventBus.getDefault().postSticky(new VehicleState(header, vehicleState));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState) {
|
||||
EventBus.getDefault().postSticky(new AutopilotState(header, autopilotState));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage) {
|
||||
EventBus.getDefault().postSticky(new MogoReportMessage(header, mogoReportMessage));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq) {
|
||||
EventBus.getDefault().postSticky(new BasicInfoReq(header, basicInfoReq));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp) {
|
||||
EventBus.getDefault().postSticky(new CarConfigResp(header, carConfigResp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel) {
|
||||
EventBus.getDefault().postSticky(new RecordPanel(header, recordPanel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp) {
|
||||
EventBus.getDefault().postSticky(new GlobalPathResp(header, globalPathResp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarn(MessagePad.Header header, MessagePad.Warn warn) {
|
||||
EventBus.getDefault().postSticky(new Warn(header, warn));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification) {
|
||||
EventBus.getDefault().postSticky(new ArrivalNotification(header, arrivalNotification));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgradeStateInfo(final IPCUpgradeStateInfo info) {
|
||||
EventBus.getDefault().postSticky(info);
|
||||
}
|
||||
|
||||
|
||||
private Toast toast;
|
||||
|
||||
public void showToastCenter(String msg) {
|
||||
if (toast != null) {
|
||||
toast.cancel();
|
||||
toast = null;
|
||||
}
|
||||
toast = Toast.makeText(this, "", Toast.LENGTH_SHORT); //如果有居中显示需求
|
||||
toast.setGravity(Gravity.CENTER, 0, 0);
|
||||
toast.setText(msg);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
|
||||
private void initAdas() {
|
||||
CupidLogUtils.e(TAG, "--->初始化");
|
||||
AdasOptions options;
|
||||
if (BuildConfig.IS_CLIENT) {
|
||||
/*—————————————作为乘客端———————————*/
|
||||
options = new AdasOptions.Builder().setClient(true).build();
|
||||
NSDNettyManager.getInstance().searchAndConnectServer(this, "1234", new NettyClientListener<MogoProtocolMsg>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onMessageResponseClient(MogoProtocolMsg msg, String sign) {
|
||||
Log.d("dddd", "12345678=" + Arrays.toString(msg.getBody()));
|
||||
AdasManager.getInstance().parseIPCData(msg.getBody());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClientStatusConnectChanged(int statusCode, String sign) {
|
||||
if (statusCode == ConnectState.STATUS_CONNECT_SUCCESS) {
|
||||
connectStatus = com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTED;
|
||||
} else {
|
||||
connectStatus = com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED;
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ipcIp.setVisibility(View.VISIBLE);
|
||||
ipcIp.setText("司机IP:" + NSDNettyManager.getInstance().getConnServerIp());
|
||||
}
|
||||
});
|
||||
onUpdateConnectStateView();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
/*—————————————作为司机端———————————*/
|
||||
int mode = Constants.getIpcConnectionMode(this);
|
||||
switch (mode) {
|
||||
default:
|
||||
case AdasOptions.IPC_CONNECTION_MODE.FIXATION:
|
||||
options = new AdasOptions.Builder().setClient(false).setIpcFixationIP(AdasManager.getInstance().getIPCFixationIPList(this)).setIpcConnectionMode(mode).build();
|
||||
break;
|
||||
case AdasOptions.IPC_CONNECTION_MODE.ASSIGN:
|
||||
options = new AdasOptions.Builder().setClient(false).setIpcAssignIP(Constants.getIPCIp(this)).setIpcConnectionMode(mode).build();
|
||||
break;
|
||||
}
|
||||
|
||||
NSDNettyManager.getInstance().startNSDNettyServer(this, new NettyServerListener() {
|
||||
@Override
|
||||
public void onMessageResponseServer(Object msg, Channel channel) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartServer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopServer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChannelConnect(Channel channel) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChannelDisConnect(Channel channel) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
AdasManager.getInstance().create(options, this);
|
||||
|
||||
AdasManager.getInstance().setOnAdasListener(this);
|
||||
// AdasManager.getInstance().setOnAdasConnectStatusListener(this);
|
||||
if (BuildConfig.IS_CLIENT) {
|
||||
/*—————————————作为乘客端———————————*/
|
||||
|
||||
} else {
|
||||
/*—————————————作为司機端———————————*/
|
||||
AdasManager.getInstance().setOnMultiDeviceListener(new OnMultiDeviceListener() {
|
||||
@Override
|
||||
public void onForwardingIPCMessage(byte[] bytes) {
|
||||
// 发送数据给乘客端
|
||||
if (NSDNettyManager.getInstance().isServerStart()) {
|
||||
NSDNettyManager.getInstance().sendMsgToAllClients(new MogoProtocolMsg(NORMAL_DATA, bytes.length, bytes));
|
||||
} else {
|
||||
Log.d("dddd", "司机端Server未启动!");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
// AdasManager.getInstance().pause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
// AdasManager.getInstance().resume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
AdasManager.getInstance().setOnAdasListener(null);
|
||||
AdasManager.getInstance().destory();
|
||||
if (mExecutorServiceConfigTimer != null) {
|
||||
mExecutorServiceConfigTimer.shutdownNow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onConnectionIPCStatus(int ipcConnectionStatus, String failedMsg) {
|
||||
connectStatus = ipcConnectionStatus;
|
||||
onUpdateConnectStateView();
|
||||
if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.CONNECTED) {
|
||||
CupidLogUtils.w(TAG, "===>MainActivity onWebSocketConnectSuccess");
|
||||
showIPCIP(AdasManager.getInstance().getIpcConnectedIp(), AdasManager.getInstance().getIpcConnectedPort());
|
||||
} else if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
toastMsg("ws连接失败:" + failedMsg);
|
||||
CupidLogUtils.w(TAG, "===>MainActivity onWebSocketConnectFailed");
|
||||
showIPCIP(AdasManager.getInstance().getIpcConnectedIp(), AdasManager.getInstance().getIpcConnectedPort());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void toastMsg(final String msg) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showLocalIP() {
|
||||
localIp.setText("本机IP:" + getIpAddressString());
|
||||
}
|
||||
|
||||
private String getIpAddressString() {
|
||||
try {
|
||||
for (Enumeration<NetworkInterface> enNetI = NetworkInterface
|
||||
.getNetworkInterfaces(); enNetI.hasMoreElements(); ) {
|
||||
NetworkInterface netI = enNetI.nextElement();
|
||||
for (Enumeration<InetAddress> enumIpAddr = netI
|
||||
.getInetAddresses(); enumIpAddr.hasMoreElements(); ) {
|
||||
InetAddress inetAddress = enumIpAddr.nextElement();
|
||||
if (inetAddress instanceof Inet4Address && !inetAddress.isLoopbackAddress()) {
|
||||
return inetAddress.getHostAddress();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "127.0.0.1";
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前设备是手机还是平板,代码来自 Google I/O App for Android
|
||||
*
|
||||
* @param context
|
||||
* @return 平板返回 True,手机返回 False
|
||||
*/
|
||||
public static boolean isPad(Context context) {
|
||||
return (context.getResources().getConfiguration().screenLayout
|
||||
& Configuration.SCREENLAYOUT_SIZE_MASK)
|
||||
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
|
||||
}
|
||||
|
||||
private void firstFragment() {
|
||||
if (carFragment == null)
|
||||
carFragment = new InfoFragment("自车状态");
|
||||
if (!carFragment.isVisible()) {
|
||||
transaction.replace(R.id.fl_info, carFragment);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(int position, String data) {
|
||||
CupidLogUtils.w(TAG, "TitleAdapter===>name:" + data);
|
||||
if (connectStatus == com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
toastMsg("IPC 未连接");
|
||||
return;
|
||||
}
|
||||
switch (data) {
|
||||
case "下发站点1":
|
||||
MessagePad.Location startLocation = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.820319143036112)
|
||||
.setLongitude(112.57770688564666)
|
||||
.build();
|
||||
MessagePad.Location endLocation = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.82355278566775)
|
||||
.setLongitude(112.57001723522112)
|
||||
.build();
|
||||
MessagePad.RouteInfo info = MessagePad.RouteInfo.newBuilder()
|
||||
.setStartLocation(startLocation)
|
||||
.setStartName("KXCNMZ")
|
||||
.setEndLocation(endLocation)
|
||||
.setEndName("SDYJKXCXMBZ")
|
||||
.addAllWayPoints(null)
|
||||
.setSpeedLimit(0.0)
|
||||
.setVehicleType(9)
|
||||
.setIsSpeakVoice(true)
|
||||
.build();
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, info);
|
||||
//"{\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.82355278566775,\"lon\":112.57001723522112},\"endName\":\"SDYJKXCXMBZ\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.820319143036112,\"lon\":112.57770688564666},\"startName\":\"KXCNMZ\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
// " {\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.819811964643154,\"lon\":112.57732459897345},\"endName\":\"KXCNMDM\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.823347858814472,\"lon\":112.56994205894226},\"startName\":\"SDYJKXCXMBDM\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
break;
|
||||
case "下发站点2":
|
||||
MessagePad.Location startLocation2 = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.823347858814472)
|
||||
.setLongitude(112.56994205894226)
|
||||
.build();
|
||||
MessagePad.Location endLocation2 = MessagePad.Location.newBuilder()
|
||||
.setLatitude(26.819811964643154)
|
||||
.setLongitude(112.57732459897345)
|
||||
.build();
|
||||
MessagePad.RouteInfo info2 = MessagePad.RouteInfo.newBuilder()
|
||||
.setStartLocation(startLocation2)
|
||||
.setStartName("SDYJKXCXMBDM")
|
||||
.setEndLocation(endLocation2)
|
||||
.setEndName("KXCNMDM")
|
||||
.addAllWayPoints(null)
|
||||
.setSpeedLimit(0.0)
|
||||
.setVehicleType(9)
|
||||
.setIsSpeakVoice(true)
|
||||
.build();
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(1, 0, info2);
|
||||
// "{\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.82355278566775,\"lon\":112.57001723522112},\"endName\":\"SDYJKXCXMBZ\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.820319143036112,\"lon\":112.57770688564666},\"startName\":\"KXCNMZ\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
//" {\"action\":\"aiCloudToStartAutopilot\",\"result\":{\"endLatLon\":{\"lat\":26.819811964643154,\"lon\":112.57732459897345},\"endName\":\"KXCNMDM\",\"isSpeakVoice\":true,\"speedLimit\":0.0,\"startLatLon\":{\"lat\":26.823347858814472,\"lon\":112.56994205894226},\"startName\":\"SDYJKXCXMBDM\",\"vehicleType\":9,\"wayLatLons\":null}}"
|
||||
break;
|
||||
case "自动驾驶路径查询":
|
||||
AdasManager.getInstance().sendGlobalPathReq();
|
||||
break;
|
||||
case "下发SN":
|
||||
//发送sn
|
||||
AdasManager.getInstance().sendBasicInfoResp("X202021111192N41VY", 1);
|
||||
break;
|
||||
case "数据采集5秒":
|
||||
boolean b = AdasManager.getInstance().startRecordPackage(1, 5, 1);
|
||||
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + b);
|
||||
break;
|
||||
case "数据采集start":
|
||||
boolean bStart = AdasManager.getInstance().startRecordPackage(1, 1);
|
||||
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + bStart);
|
||||
break;
|
||||
case "数据采集end":
|
||||
boolean bEnd = AdasManager.getInstance().stopRecordPackage(1, 1);
|
||||
CupidLogUtils.w(TAG, "AutopilotRecord===>send:" + bEnd);
|
||||
break;
|
||||
case "录音测试":
|
||||
CupidLogUtils.w(TAG, "录音测试");
|
||||
RecordDataManager.getInstance().init(MainActivity.this, "1234567", "", 22, "", "");
|
||||
RecordDataManager.getInstance().record();
|
||||
break;
|
||||
case "发送信号灯":
|
||||
AdasManager.getInstance().sendTrafficLightData(null);
|
||||
break;
|
||||
case "速度设置":
|
||||
AdasManager.getInstance().sendAutopilotSpeedReq(30);
|
||||
break;
|
||||
case "重启Docker":
|
||||
AdasManager.getInstance().rebootAPDocker();
|
||||
break;
|
||||
case "重启IPC":
|
||||
AdasManager.getInstance().rebootIPC();
|
||||
break;
|
||||
case "关机":
|
||||
AdasManager.getInstance().shutdownIPC();
|
||||
break;
|
||||
case "采集类型":
|
||||
AdasManager.getInstance().sendRecordCause(recordKey, recordFileName, "1", "变道有干扰");
|
||||
break;
|
||||
case "打开演示模式":
|
||||
AdasManager.getInstance().sendDemoModeReq(1);
|
||||
break;
|
||||
case "关闭演示模式":
|
||||
AdasManager.getInstance().sendDemoModeReq(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeInfo;
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @des 升级页面
|
||||
*/
|
||||
public class UpgradeFragment extends Fragment {
|
||||
private final int[] colors = {Color.parseColor("#FA8072"), Color.parseColor("#FF00FF"), Color.parseColor("#228B22"), Color.parseColor("#871f78")};
|
||||
private final Random random = new Random();
|
||||
|
||||
private String title;
|
||||
|
||||
public UpgradeFragment() {
|
||||
}
|
||||
|
||||
public UpgradeFragment(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_upgrade, container, false);
|
||||
initView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
private TextView tvTitle;
|
||||
private TextView text2;
|
||||
private Button btn1;
|
||||
private Button btn2;
|
||||
|
||||
private void initView(View view) {
|
||||
tvTitle = view.findViewById(R.id.tv_title);
|
||||
text2 = view.findViewById(R.id.text2);
|
||||
btn1 = view.findViewById(R.id.btn1);
|
||||
btn2 = view.findViewById(R.id.btn2);
|
||||
CupidLogUtils.w("InfoFragment===>" + title);
|
||||
tvTitle.setText(title);
|
||||
tvTitle.setGravity(Gravity.CENTER);
|
||||
|
||||
btn1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.affirm());
|
||||
}
|
||||
});
|
||||
|
||||
btn2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
AdasManager.getInstance().sendBaseInfo(IPCUpgradeInfo.cancel());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onIPCUpgradeStateInfo(IPCUpgradeStateInfo info) {
|
||||
text2.setTextColor(colors[random.nextInt(4)]);
|
||||
text2.setText("IPC升级 \nUpgradeStatus:" + IPCUpgradeStateInfo.UpgradeStatus.getStatus(info.getUpgradeStatus()) +
|
||||
"\nDownloadStatus:" + IPCUpgradeStateInfo.DownloadStatus.getStatus(info.getDownloadStatus()) +
|
||||
"\nUpgradeMode:" + IPCUpgradeStateInfo.UpgradeMode.getStatus(info.getUpgradeMode()) +
|
||||
"\nProgress:" + info.getProgress() +
|
||||
"\nImages:" + info.getImages());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package com.zhidao.adas.client.ui.mian;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
import com.zhidao.adas.client.BuildConfig;
|
||||
import com.zhidao.adas.client.R;
|
||||
import com.zhidao.adas.client.bean.CarConfigResp;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @des 升级页面
|
||||
*/
|
||||
public class VersionFragment extends Fragment {
|
||||
|
||||
|
||||
private String title;
|
||||
|
||||
public VersionFragment() {
|
||||
}
|
||||
|
||||
public VersionFragment(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_version, container, false);
|
||||
initView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
showIps();
|
||||
}
|
||||
|
||||
|
||||
private void showIps() {
|
||||
HashSet<String> ips = AdasManager.getInstance().getIPCFixationIPList(getActivity());
|
||||
if (ips != null && !ips.isEmpty()) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
int i = 0;
|
||||
for (String ip : ips) {
|
||||
i++;
|
||||
builder.append(ip);
|
||||
if (i % 2 == 0) {
|
||||
builder.append("\n");
|
||||
} else {
|
||||
builder.append("\t\t\t\t");
|
||||
}
|
||||
}
|
||||
ipsView.setText(builder.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private TextView tvTitle;
|
||||
private TextView ipcIpView;
|
||||
private TextView ipcVersionView;
|
||||
private TextView plate_number_view;
|
||||
private TextView mac_address_view;
|
||||
private TextView protocol_version_view;
|
||||
private TextView app_protocol_version_view;
|
||||
private TextView speed_limit_view;
|
||||
private TextView ipcIpHint;
|
||||
private TextView ipcVersionHint;
|
||||
private TextView plate_number_hint;
|
||||
private TextView appVersionView;
|
||||
private TextView mac_address_hint;
|
||||
private TextView protocol_version_hint;
|
||||
private TextView app_protocol_version_hint;
|
||||
private TextView speed_limit_hint;
|
||||
private TextView mapVersionView;
|
||||
private TextView ipsView;
|
||||
private Button btn1;
|
||||
private Button btn2;
|
||||
private EditText ipView;
|
||||
private View layoutVersion;
|
||||
|
||||
private void initView(View view) {
|
||||
tvTitle = view.findViewById(R.id.tv_title);
|
||||
btn1 = view.findViewById(R.id.btn1);
|
||||
ipView = view.findViewById(R.id.ip);
|
||||
btn2 = view.findViewById(R.id.btn2);
|
||||
ipcIpView = view.findViewById(R.id.ipc_ip_view);
|
||||
ipcVersionView = view.findViewById(R.id.ipc_version_view);
|
||||
plate_number_view = view.findViewById(R.id.plate_number_view);
|
||||
mac_address_view = view.findViewById(R.id.mac_address_view);
|
||||
protocol_version_view = view.findViewById(R.id.protocol_version_view);
|
||||
app_protocol_version_view = view.findViewById(R.id.app_protocol_version_view);
|
||||
speed_limit_view = view.findViewById(R.id.speed_limit_view);
|
||||
|
||||
ipcIpHint = view.findViewById(R.id.ipc_ip_hint);
|
||||
ipcVersionHint = view.findViewById(R.id.ipc_version_hint);
|
||||
plate_number_hint = view.findViewById(R.id.plate_number_hint);
|
||||
mac_address_hint = view.findViewById(R.id.mac_address_hint);
|
||||
protocol_version_hint = view.findViewById(R.id.protocol_version_hint);
|
||||
app_protocol_version_hint = view.findViewById(R.id.app_protocol_version_hint);
|
||||
speed_limit_hint = view.findViewById(R.id.speed_limit_hint);
|
||||
appVersionView = view.findViewById(R.id.app_version_view);
|
||||
mapVersionView = view.findViewById(R.id.map_version_view);
|
||||
layoutVersion = view.findViewById(R.id.layout_version);
|
||||
ipsView = view.findViewById(R.id.ips_view);
|
||||
|
||||
CupidLogUtils.w("InfoFragment===>" + title);
|
||||
tvTitle.setText(title);
|
||||
tvTitle.setGravity(Gravity.CENTER);
|
||||
|
||||
btn1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String ip = ipView.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(ip)) {
|
||||
Toast.makeText(getContext(), "请输入IP", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (AdasManager.getInstance().addIPCFixationIP(getContext(), ip)) {
|
||||
ipView.setText("");
|
||||
showIps();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "IP已存在", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
btn2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String ip = ipView.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(ip)) {
|
||||
Toast.makeText(getContext(), "请输入IP", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if (AdasManager.getInstance().delIPCFixationIP(getContext(), ip)) {
|
||||
ipView.setText("");
|
||||
showIps();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "IP不存在", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void showVersion(CarConfigResp adasConfig) {
|
||||
layoutVersion.setVisibility(View.VISIBLE);
|
||||
if (!BuildConfig.IS_CLIENT) {
|
||||
String ip = AdasManager.getInstance().getIpcConnectedIp();
|
||||
if (!TextUtils.isEmpty(ip)) {
|
||||
if (!ip.contains(":")) {
|
||||
ip = ip + ":" + Constants.DEFAULT_PORT;
|
||||
}
|
||||
}
|
||||
ipcIpView.setText(ip);
|
||||
ipcVersionView.setText(adasConfig.bean.getDockVersion());
|
||||
plate_number_view.setText(adasConfig.bean.getPlateNumber());
|
||||
mac_address_view.setText(adasConfig.bean.getMacAddress());
|
||||
speed_limit_view.setText(String.valueOf(adasConfig.bean.getSpeedLimit()));
|
||||
protocol_version_view.setText(String.valueOf(adasConfig.bean.getProtocolVersion().getNumber()));
|
||||
app_protocol_version_view.setText(String.valueOf(AdasManager.getInstance().getProtocolVersion()));
|
||||
} else {
|
||||
ipcIpView.setVisibility(View.GONE);
|
||||
ipcVersionView.setVisibility(View.GONE);
|
||||
ipcIpHint.setVisibility(View.GONE);
|
||||
ipcVersionHint.setVisibility(View.GONE);
|
||||
plate_number_hint.setVisibility(View.GONE);
|
||||
appVersionView.setVisibility(View.GONE);
|
||||
mac_address_hint.setVisibility(View.GONE);
|
||||
speed_limit_hint.setVisibility(View.GONE);
|
||||
protocol_version_hint.setVisibility(View.GONE);
|
||||
app_protocol_version_hint.setVisibility(View.GONE);
|
||||
}
|
||||
// appVersionView.setText(AppUtils.getAppVersionName());
|
||||
mapVersionView.setText(AdasManager.getInstance().getAPVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.zhidao.adas.client.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/10/8
|
||||
*/
|
||||
public class Constants {
|
||||
public static final String ALL_PATH = "all_path";//所有路线
|
||||
public static final String SEL_PATH = "sel_path";//选择的路线
|
||||
|
||||
/***********************是否使用固定IP******************/
|
||||
// 0:固定IP 1:指定 2:UDP
|
||||
private static final String IPC_CONNECTION_MODE = "ipc_connection_mode";
|
||||
|
||||
public static void setIpcConnectionMode(Context context, int type) {
|
||||
PreferencesUtils.putInt(context, IPC_CONNECTION_MODE, type);
|
||||
}
|
||||
|
||||
public static int getIpcConnectionMode(Context context) {
|
||||
return PreferencesUtils.getInt(context, IPC_CONNECTION_MODE, 0);
|
||||
}
|
||||
|
||||
public static boolean delIpcConnectionMode(Context context) {
|
||||
return PreferencesUtils.delete(context, IPC_CONNECTION_MODE);
|
||||
}
|
||||
|
||||
/***********************保存IP******************/
|
||||
private static final String IPC_IP = "ipc_ip";
|
||||
|
||||
public static void setIPCIp(Context context, String ip) {
|
||||
PreferencesUtils.putString(context, IPC_IP, ip);
|
||||
}
|
||||
|
||||
public static String getIPCIp(Context context) {
|
||||
return PreferencesUtils.getString(context, IPC_IP, null);
|
||||
}
|
||||
|
||||
public static boolean delIPCIp(Context context) {
|
||||
return PreferencesUtils.delete(context, IPC_IP);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.zhidao.adas.client.utils;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des
|
||||
* @date 2021/2/5
|
||||
*/
|
||||
class FileUtils {
|
||||
|
||||
/**
|
||||
* 创建文件
|
||||
*
|
||||
* @param data
|
||||
* @param name
|
||||
*/
|
||||
public static void createFile(Context context, String data, String name) {
|
||||
try {
|
||||
File file = new File(context.getExternalFilesDir(null) + "/" + name);
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
Writer out = new FileWriter(file,true);
|
||||
out.write(data);
|
||||
out.append("\n");
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zhidao.adas.client.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class MyLinearLayoutManager extends LinearLayoutManager {
|
||||
public MyLinearLayoutManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MyLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
|
||||
super(context, orientation, reverseLayout);
|
||||
}
|
||||
|
||||
public MyLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsPredictiveItemAnimations() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
|
||||
//override this method and implement code as below
|
||||
try {
|
||||
super.onLayoutChildren(recycler, state);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,286 @@
|
||||
package com.zhidao.adas.client.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
public class PreferencesUtils {
|
||||
|
||||
public static String PREFERENCE_NAME = "control";
|
||||
|
||||
public static boolean hasString(Context context, String key) {
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return settings.contains(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* put string preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to modify
|
||||
* @param value The new value for the preference
|
||||
* @return True if the new values were successfully written to persistent
|
||||
* storage.
|
||||
*/
|
||||
public static boolean putString(Context context, String key, String value) {
|
||||
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putString(key, value);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* get string preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @return The preference value if it exists, or null. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a string
|
||||
* @see #getString(Context, String, String)
|
||||
*/
|
||||
public static String getString(Context context, String key) {
|
||||
if (context == null) return null;
|
||||
return getString(context, key, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* get string preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @param defaultValue Value to return if this preference does not exist
|
||||
* @return The preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a string
|
||||
*/
|
||||
public static String getString(Context context, String key,
|
||||
String defaultValue) {
|
||||
|
||||
if (context == null) return defaultValue;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return settings.getString(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* put int preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to modify
|
||||
* @param value The new value for the preference
|
||||
* @return True if the new values were successfully written to persistent
|
||||
* storage.
|
||||
*/
|
||||
public static boolean putInt(Context context, String key, int value) {
|
||||
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putInt(key, value);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* get int preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @return The preference value if it exists, or -1. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a int
|
||||
* @see #getInt(Context, String, int)
|
||||
*/
|
||||
public static int getInt(Context context, String key) {
|
||||
|
||||
if (context == null) return -1;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return getInt(context, key, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* get int preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @param defaultValue Value to return if this preference does not exist
|
||||
* @return The preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a int
|
||||
*/
|
||||
public static int getInt(Context context, String key, int defaultValue) {
|
||||
if (context == null) return defaultValue;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return settings.getInt(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* put long preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to modify
|
||||
* @param value The new value for the preference
|
||||
* @return True if the new values were successfully written to persistent
|
||||
* storage.
|
||||
*/
|
||||
public static boolean putLong(Context context, String key, long value) {
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putLong(key, value);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* get long preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @return The preference value if it exists, or -1. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a long
|
||||
* @see #getLong(Context, String, long)
|
||||
*/
|
||||
public static long getLong(Context context, String key) {
|
||||
if (context == null) return -1;
|
||||
return getLong(context, key, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* get long preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @param defaultValue Value to return if this preference does not exist
|
||||
* @return The preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a long
|
||||
*/
|
||||
public static long getLong(Context context, String key, long defaultValue) {
|
||||
if (context == null) return defaultValue;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
|
||||
return settings.getLong(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* put float preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to modify
|
||||
* @param value The new value for the preference
|
||||
* @return True if the new values were successfully written to persistent
|
||||
* storage.
|
||||
*/
|
||||
public static boolean putFloat(Context context, String key, float value) {
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putFloat(key, value);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* get float preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @return The preference value if it exists, or -1. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a float
|
||||
* @see #getFloat(Context, String, float)
|
||||
*/
|
||||
public static float getFloat(Context context, String key) {
|
||||
if (context == null) return -1;
|
||||
return getFloat(context, key, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* get float preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @param defaultValue Value to return if this preference does not exist
|
||||
* @return The preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a float
|
||||
*/
|
||||
public static float getFloat(Context context, String key, float defaultValue) {
|
||||
if (context == null) return defaultValue;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return settings.getFloat(key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* put boolean preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to modify
|
||||
* @param value The new value for the preference
|
||||
* @return True if the new values were successfully written to persistent
|
||||
* storage.
|
||||
*/
|
||||
public static boolean putBoolean(Context context, String key, boolean value) {
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putBoolean(key, value);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* get boolean preferences, default is false
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @return The preference value if it exists, or false. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a boolean
|
||||
* @see #getBoolean(Context, String, boolean)
|
||||
*/
|
||||
public static boolean getBoolean(Context context, String key) {
|
||||
if (context == null) return false;
|
||||
return getBoolean(context, key, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* get boolean preferences
|
||||
*
|
||||
* @param context
|
||||
* @param key The name of the preference to retrieve
|
||||
* @param defaultValue Value to return if this preference does not exist
|
||||
* @return The preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that
|
||||
* is not a boolean
|
||||
*/
|
||||
public static boolean getBoolean(Context context, String key,
|
||||
boolean defaultValue) {
|
||||
if (context == null) return defaultValue;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
return settings.getBoolean(key, defaultValue);
|
||||
}
|
||||
|
||||
|
||||
public static boolean delete(Context context, String key) {
|
||||
if (context == null) return false;
|
||||
SharedPreferences settings = context.getSharedPreferences(
|
||||
PREFERENCE_NAME, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.remove(key);
|
||||
return editor.commit();
|
||||
}
|
||||
|
||||
}
|
||||
BIN
app_ipc_monitoring/src/main/res/drawable/border_title.png
Normal file
BIN
app_ipc_monitoring/src/main/res/drawable/border_title.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
19
app_ipc_monitoring/src/main/res/drawable/btn_bg.xml
Normal file
19
app_ipc_monitoring/src/main/res/drawable/btn_bg.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<!-- 圆角深红色按钮 -->
|
||||
<solid android:color="#4D0A0A" />
|
||||
<corners android:radius="8dip" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_pressed="false">
|
||||
<shape android:shape="rectangle">
|
||||
<!-- 圆角红色按钮 -->
|
||||
<solid android:color="#D9534F" />
|
||||
<corners android:radius="8dip" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="162.5625dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="2601"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M0,1023.61V697.58h19.71V326.22h-19.71V0h355.2V19.91h1890.72V0h355.2v326.22h-19.71v371.36h19.71v326.02h-355.2v-19.71H355.2v19.71H59.21M355.2,39.62v19.71H59.21v266.89h-19.71v371.36h19.71v266.89h295.98v19.71h1890.72v-19.71h296V697.58h19.71V326.22h-19.71V59.33h-296V39.62H355.2z"
|
||||
android:fillColor="#0e932e"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="162.5625dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="2601"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M0,1023.61V697.58h19.71V326.22h-19.71V0h355.2V19.91h1890.72V0h355.2v326.22h-19.71v371.36h19.71v326.02h-355.2v-19.71H355.2v19.71H59.21M355.2,39.62v19.71H59.21v266.89h-19.71v371.36h19.71v266.89h295.98v19.71h1890.72v-19.71h296V697.58h19.71V326.22h-19.71V59.33h-296V39.62H355.2z"
|
||||
android:fillColor="#d81e06"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="162.5625dp"
|
||||
android:height="64dp"
|
||||
android:viewportWidth="2601"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M0,1023.61V697.58h19.71V326.22h-19.71V0h355.2V19.91h1890.72V0h355.2v326.22h-19.71v371.36h19.71v326.02h-355.2v-19.71H355.2v19.71H59.21M355.2,39.62v19.71H59.21v266.89h-19.71v371.36h19.71v266.89h295.98v19.71h1890.72v-19.71h296V697.58h19.71V326.22h-19.71V59.33h-296V39.62H355.2z"
|
||||
android:fillColor="#f4ea2a"/>
|
||||
</vector>
|
||||
69
app_ipc_monitoring/src/main/res/drawable/icon.xml
Normal file
69
app_ipc_monitoring/src/main/res/drawable/icon.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="200dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:pathData="M871.68,277.12L972.8,491.52V569.6s-8.32,76.16 -78.08,95.36H108.16S57.6,668.16 44.8,646.4V516.48s-2.56,-34.56 38.4,-52.48l202.24,-49.28s123.52,-136.32 154.24,-144.64l432,7.04z"
|
||||
android:fillColor="#F8F8FF"/>
|
||||
<path
|
||||
android:pathData="M99.84,678.4c-17.92,0 -53.12,-3.2 -65.92,-25.6 -1.28,-1.92 -1.92,-4.48 -1.92,-6.4V516.48c0,-5.76 0,-44.16 46.08,-64 0.64,0 1.28,-0.64 1.92,-0.64l198.4,-48c26.24,-28.8 126.72,-136.96 157.44,-145.28 1.28,0 2.56,-0.64 3.84,-0.64l432,6.4c5.12,0 9.6,3.2 11.52,7.04L984.32,486.4c0.64,1.92 1.28,3.84 1.28,5.76V571.52c-0.64,3.2 -10.24,85.12 -87.68,106.88 -1.28,0 -2.56,0.64 -3.2,0.64H108.16c-1.28,-0.64 -4.48,-0.64 -8.32,-0.64zM57.6,642.56c8.32,8.32 33.92,11.52 49.92,10.24H892.8c56.32,-16.64 66.56,-76.8 67.2,-83.84V494.72l-96,-204.8 -421.76,-6.4c-19.2,7.68 -88.32,76.16 -146.56,140.16 -1.92,1.92 -3.84,3.2 -6.4,3.84l-201.6,49.28c-30.72,14.08 -30.08,38.4 -30.08,39.04v126.72z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M771.2,659.2m-140.16,0a140.16,140.16 0,1 0,280.32 0,140.16 140.16,0 1,0 -280.32,0Z"
|
||||
android:fillColor="#CBD6E2"/>
|
||||
<path
|
||||
android:pathData="M771.2,812.16c-84.48,0 -152.96,-68.48 -152.96,-152.96s68.48,-152.96 152.96,-152.96 152.96,68.48 152.96,152.96 -69.12,152.96 -152.96,152.96zM771.2,531.84c-70.4,0 -127.36,56.96 -127.36,127.36s56.96,127.36 127.36,127.36c70.4,0 127.36,-56.96 127.36,-127.36s-57.6,-127.36 -127.36,-127.36z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M771.2,659.2m-56.32,0a56.32,56.32 0,1 0,112.64 0,56.32 56.32,0 1,0 -112.64,0Z"
|
||||
android:fillColor="#DFECF7"/>
|
||||
<path
|
||||
android:pathData="M771.2,728.32c-38.4,0 -69.12,-30.72 -69.12,-69.12s30.72,-69.12 69.12,-69.12 69.12,30.72 69.12,69.12 -31.36,69.12 -69.12,69.12zM771.2,615.68c-23.68,0 -43.52,19.2 -43.52,43.52s19.2,43.52 43.52,43.52 43.52,-19.2 43.52,-43.52 -19.84,-43.52 -43.52,-43.52z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M305.92,667.52m-140.16,0a140.16,140.16 0,1 0,280.32 0,140.16 140.16,0 1,0 -280.32,0Z"
|
||||
android:fillColor="#CBD6E2"/>
|
||||
<path
|
||||
android:pathData="M305.92,820.48c-84.48,0 -152.96,-68.48 -152.96,-152.96s68.48,-152.96 152.96,-152.96 152.96,68.48 152.96,152.96 -69.12,152.96 -152.96,152.96zM305.92,540.16c-70.4,0 -127.36,56.96 -127.36,127.36s56.96,127.36 127.36,127.36c70.4,0 127.36,-56.96 127.36,-127.36s-57.6,-127.36 -127.36,-127.36z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M305.92,667.52m-56.32,0a56.32,56.32 0,1 0,112.64 0,56.32 56.32,0 1,0 -112.64,0Z"
|
||||
android:fillColor="#DFECF7"/>
|
||||
<path
|
||||
android:pathData="M305.92,736.64c-38.4,0 -69.12,-30.72 -69.12,-69.12s30.72,-69.12 69.12,-69.12 69.12,30.72 69.12,69.12 -31.36,69.12 -69.12,69.12zM305.92,624c-23.68,0 -43.52,19.2 -43.52,43.52s19.2,43.52 43.52,43.52 43.52,-19.2 43.52,-43.52 -19.84,-43.52 -43.52,-43.52z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M117.76,464s5.76,64 -65.92,96.64l1.92,-55.68s2.56,-28.8 32.64,-39.04l31.36,-8.32v6.4z"
|
||||
android:fillColor="#FEF185"/>
|
||||
<path
|
||||
android:pathData="M38.4,580.48l2.56,-76.8c0,-1.28 3.2,-37.12 40.96,-49.92h0.64L128,441.6l2.56,21.12c0,3.2 5.76,73.6 -73.6,109.44L38.4,580.48zM65.92,505.6l-0.64,32.64c31.36,-21.76 38.4,-49.92 39.68,-64.64l-15.36,4.48c-20.48,7.04 -23.04,25.6 -23.68,27.52z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M850.56,309.12l55.04,131.2 -568.96,-9.6 122.24,-128.64z"
|
||||
android:fillColor="#D0E5FE"/>
|
||||
<path
|
||||
android:pathData="M905.6,454.4l-569.6,-10.24c-5.12,0 -9.6,-3.2 -11.52,-8.32s-1.28,-10.24 2.56,-14.08l122.24,-128.64c2.56,-2.56 5.76,-4.48 9.6,-3.84l391.68,6.4c5.12,0 9.6,3.2 11.52,7.68l55.68,131.2c1.92,3.84 1.28,8.96 -1.28,12.8 -2.56,4.48 -6.4,7.04 -10.88,7.04zM366.08,418.56l520.32,8.32 -44.8,-105.6 -377.6,-6.4 -97.92,103.68z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M582.4,300.8v147.2"
|
||||
android:fillColor="#F8F8FF"/>
|
||||
<path
|
||||
android:pathData="M569.6,300.8h25.6v147.2h-25.6z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M246.4,355.2h-0.64c-7.04,-0.64 -12.16,-6.4 -12.16,-13.44 1.92,-31.36 27.52,-42.88 44.16,-42.88 7.04,0 12.8,5.76 12.8,12.8s-5.76,12.8 -12.8,12.8c-3.84,0 -17.28,1.92 -18.56,19.2 0,6.4 -5.76,11.52 -12.8,11.52z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M197.76,336.64h-0.64c-7.04,-0.64 -12.16,-6.4 -12.16,-13.44 3.2,-51.84 44.8,-65.92 66.56,-65.92 7.04,0 12.8,5.76 12.8,12.8s-5.76,12.8 -12.8,12.8c-3.84,0 -38.4,1.92 -40.96,41.6 -0.64,6.4 -6.4,12.16 -12.8,12.16z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M136.32,322.56h-0.64c-7.04,-0.64 -12.16,-6.4 -12.16,-13.44 4.48,-83.2 71.04,-104.96 104.96,-104.96 7.04,0 12.8,5.76 12.8,12.8s-5.76,12.8 -12.8,12.8c-3.2,0 -74.88,1.28 -80,80.64 0,7.04 -5.76,12.16 -12.16,12.16z"
|
||||
android:fillColor="#708DB7"/>
|
||||
<path
|
||||
android:pathData="M524.8,486.4h44.8"
|
||||
android:fillColor="#F8F8FF"/>
|
||||
<path
|
||||
android:pathData="M569.6,499.2h-44.8c-7.04,0 -12.8,-5.76 -12.8,-12.8s5.76,-12.8 12.8,-12.8h44.8c7.04,0 12.8,5.76 12.8,12.8s-5.76,12.8 -12.8,12.8z"
|
||||
android:fillColor="#708DB7"/>
|
||||
</vector>
|
||||
31
app_ipc_monitoring/src/main/res/drawable/item_bg.xml
Normal file
31
app_ipc_monitoring/src/main/res/drawable/item_bg.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_selected="true">
|
||||
<shape android:shape="rectangle">
|
||||
<!-- 圆角红色按钮 -->
|
||||
<solid android:color="#00BFFF" />
|
||||
<corners android:radius="8dp" />
|
||||
<!--边框填充色,边框宽度-->
|
||||
<stroke android:width="1dp" android:color="#B0E0E6" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<!-- 圆角深红色按钮 -->
|
||||
<solid android:color="#808080" />
|
||||
<corners android:radius="8dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:state_pressed="false">
|
||||
<shape android:shape="rectangle">
|
||||
<!-- 圆角红色按钮 -->
|
||||
<solid android:color="#C0C0C0" />
|
||||
<corners android:radius="8dp" />
|
||||
<!--边框填充色,边框宽度-->
|
||||
<stroke android:width="1dp" android:color="#808080" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="#7CFC00" android:state_pressed="true" />
|
||||
<item android:color="#7CFC00" android:state_checked="true" />
|
||||
<item android:color="#8B4513" android:state_selected="true" />
|
||||
<item android:color="#FFFFFF" />
|
||||
</selector>
|
||||
@@ -0,0 +1,529 @@
|
||||
<?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="match_parent"
|
||||
android:background="#FFF"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始执行自动驾驶" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="存储配置" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线1"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat1"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线2"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat2"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线3"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat3"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/path4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="路线4"
|
||||
android:textColor="#000"
|
||||
android:textSize="25sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="开始Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lon4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="开始Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/start_lat4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="结束Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lon4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="结束Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/stop_lat4"
|
||||
android:layout_width="120dp"
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="途径点Lon:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lon4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="途径点Lat:"
|
||||
android:textColor="#000"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/t_lat4"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
297
app_ipc_monitoring/src/main/res/layout/activity_guardian.xml
Normal file
297
app_ipc_monitoring/src/main/res/layout/activity_guardian.xml
Normal file
@@ -0,0 +1,297 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.guardian.GuardianActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:background="@color/colorBlue2"
|
||||
android:padding="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_car_type"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="车型"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorWhile"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ws_state"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="ws状态"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorWhile"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cloud_state"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="云状态"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorWhile"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_guardian_update"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="点击查询"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorLimeGreen"
|
||||
android:onClick="clientQuery"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_eagle_hz"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="0"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorLimeGreen"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_net_flow"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="match_parent"
|
||||
android:text="net"
|
||||
android:gravity="right"
|
||||
android:textSize="12dp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorWhile"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<HorizontalScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="软件节点"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_node"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_topic"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="Topic"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_topic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="硬件节点"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_hardware"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_cpu"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="CPU状态"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_cpu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_cpu_program"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:text="CPU Top10"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_cpu_program"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_mem"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:text="内存状态"
|
||||
android:layout_margin="5dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_mem"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_mem_program"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:text="内存 Top10"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_mem_program"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/include_line"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_disk"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:gravity="center"
|
||||
android:layout_margin="5dp"
|
||||
android:text="磁盘状态"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/border_title"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_disk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
</HorizontalScrollView>
|
||||
</LinearLayout>
|
||||
49
app_ipc_monitoring/src/main/res/layout/activity_main.xml
Normal file
49
app_ipc_monitoring/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#F5F5F5"
|
||||
tools:context=".ui.mian.MainActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/include_title"
|
||||
layout="@layout/item_main" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/include_title"
|
||||
android:layout_margin="3dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/info_fragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight=".15" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="#ffffff" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/info_btn"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight=".225" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
34
app_ipc_monitoring/src/main/res/layout/fragment_info.xml
Normal file
34
app_ipc_monitoring/src/main/res/layout/fragment_info.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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="match_parent"
|
||||
android:background="@color/colorWhile"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:background="#DCDCDC">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:text="INFO TITLE"
|
||||
android:textColor="#40E0D0"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
70
app_ipc_monitoring/src/main/res/layout/fragment_upgrade.xml
Normal file
70
app_ipc_monitoring/src/main/res/layout/fragment_upgrade.xml
Normal file
@@ -0,0 +1,70 @@
|
||||
<?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="match_parent"
|
||||
android:background="@color/colorWhile"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:background="#DCDCDC">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:text="INFO TITLE"
|
||||
android:textColor="#40E0D0"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="确定升级"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="取消升级"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="延迟升级(最长50分钟)"
|
||||
android:textColor="#ffffff" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="#000"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
247
app_ipc_monitoring/src/main/res/layout/fragment_version.xml
Normal file
247
app_ipc_monitoring/src/main/res/layout/fragment_version.xml
Normal file
@@ -0,0 +1,247 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorWhile"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="25dp"
|
||||
android:background="#DCDCDC">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:text="INFO TITLE"
|
||||
android:textColor="#40E0D0"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_version"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ipc_ip_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="工控机IP:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ipc_version_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="工控机版本:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/plate_number_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="车牌号:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mac_address_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="MAC地址:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/speed_limit_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="自动驾驶限速:"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/protocol_version_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="IPC通信协议版本:"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/app_protocol_version_hint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="APP通信协议版本:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="软件版本:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="MAP版本:"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ipc_ip_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ipc_version_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/plate_number_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mac_address_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/speed_limit_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/protocol_version_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/app_protocol_version_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:id="@+id/app_version_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/map_version_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorAccent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/ip"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:digits="0123456789.:"
|
||||
android:gravity="center"
|
||||
android:hint="输入IP添加或删除"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:inputType="number"
|
||||
android:maxLength="21"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textSize="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="添加"
|
||||
android:textColor="#ffffff"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn2"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ip" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_toEndOf="@id/btn1"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="删除"
|
||||
android:textColor="#ffffff"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/btn1"
|
||||
app:layout_constraintTop_toBottomOf="@id/ip" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ips_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:lineSpacingExtra="5dp"
|
||||
android:textIsSelectable="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btn1" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
14
app_ipc_monitoring/src/main/res/layout/include_line.xml
Normal file
14
app_ipc_monitoring/src/main/res/layout/include_line.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp">
|
||||
|
||||
<View
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorSlateGray"/>
|
||||
|
||||
</LinearLayout>
|
||||
14
app_ipc_monitoring/src/main/res/layout/include_line2.xml
Normal file
14
app_ipc_monitoring/src/main/res/layout/include_line2.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="@color/colorSlateGray"/>
|
||||
|
||||
</LinearLayout>
|
||||
19
app_ipc_monitoring/src/main/res/layout/item_info.xml
Normal file
19
app_ipc_monitoring/src/main/res/layout/item_info.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="4dp"
|
||||
android:background="@drawable/item_bg">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_info_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:text="INFO"
|
||||
android:textColor="@drawable/item_text_color"
|
||||
android:textSize="16dp" />
|
||||
|
||||
</LinearLayout>
|
||||
42
app_ipc_monitoring/src/main/res/layout/item_log_info.xml
Normal file
42
app_ipc_monitoring/src/main/res/layout/item_log_info.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--测试列表Item-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/layout_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/log"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent"
|
||||
android:cursorVisible="false"
|
||||
android:focusable="false"
|
||||
android:textSize="14dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
200
app_ipc_monitoring/src/main/res/layout/item_main.xml
Normal file
200
app_ipc_monitoring/src/main/res/layout/item_main.xml
Normal file
@@ -0,0 +1,200 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:background="@color/colorBlue2"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="工控机"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="18dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/role"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/title"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/title"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="14dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBaseline="@id/title"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/role"
|
||||
android:gravity="center_vertical"
|
||||
android:text="本机IP:"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="10dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ipc_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/local_ip"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_toEndOf="@id/role"
|
||||
android:gravity="center_vertical"
|
||||
android:text="IPC IP:"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="10dp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_connect_state"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="20dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:text="未连接"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line2"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toStartOf="@+id/tv_connect_state"
|
||||
android:background="#fff124" />
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switch_log"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toLeftOf="@+id/line2"
|
||||
android:checked="true"
|
||||
android:text="日志:开"
|
||||
android:textColor="@color/colorWhile" />
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toStartOf="@+id/switch_log"
|
||||
android:background="#fff124" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/disconnect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_toStartOf="@+id/line1"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="断开"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/connect"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_toStartOf="@+id/disconnect"
|
||||
android:background="@drawable/btn_bg"
|
||||
android:text="连接"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:id="@+id/line"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toStartOf="@+id/connect"
|
||||
android:background="#fff124" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/connection_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toStartOf="@+id/line"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/assign"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="指定"
|
||||
android:textColor="#ffffff" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/fixation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="固定"
|
||||
android:textColor="#ffffff" />
|
||||
</RadioGroup>
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_toStartOf="@+id/connection_type"
|
||||
android:digits="0123456789.:"
|
||||
android:gravity="right|center_vertical"
|
||||
android:hint="IP地址"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:inputType="number"
|
||||
android:maxLength="21"
|
||||
android:maxLines="1"
|
||||
android:minWidth="100dp"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_toStartOf="@+id/et_ip"
|
||||
android:gravity="right|center_vertical"
|
||||
android:text="指定IP:"
|
||||
android:textColor="@color/colorWhile"
|
||||
android:textSize="16dp"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
63
app_ipc_monitoring/src/main/res/layout/item_node.xml
Normal file
63
app_ipc_monitoring/src/main/res/layout/item_node.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?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:orientation="vertical"
|
||||
android:background="@drawable/ic_border_green"
|
||||
android:id="@+id/ll_state"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="25dp"
|
||||
android:paddingRight="20dp"
|
||||
android:layout_marginTop="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="NAME"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/colorBlock"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_node_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="NODE_NAME"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/colorBlock"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginBottom="6dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_node_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="NODE_STATE"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/colorBlock"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_disk_one"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorBlock"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_disk_two"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorBlock"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_disk_three"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/colorBlock"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
20
app_ipc_monitoring/src/main/res/values/colors.xml
Normal file
20
app_ipc_monitoring/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#008577</color>
|
||||
<color name="colorPrimaryDark">#00574B</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
<color name="colorGold">#FFD700</color>
|
||||
<color name="colorBlue">#102b6a</color>
|
||||
<color name="colorBlue2">#224b8f</color>
|
||||
<color name="colorWhile">#FFFFFF</color>
|
||||
<color name="colorBlock">#000000</color>
|
||||
<color name="colorDeepPink">#FF1493</color>
|
||||
<color name="colorCrimson">#DC143C</color>
|
||||
<color name="colorLimeGreen">#32CD32</color>
|
||||
<color name="colorSlateGray">#708090</color>
|
||||
<color name="connect_status_connected">#32CD32</color>
|
||||
<color name="connect_status_disconnected">#DC143C</color>
|
||||
<color name="connect_status_connecting">#FF00FF</color>
|
||||
<color name="connect_status_disconnecting">#DAA520</color>
|
||||
<color name="connect_status_search_address">#1E90FF</color>
|
||||
</resources>
|
||||
3
app_ipc_monitoring/src/main/res/values/strings.xml
Normal file
3
app_ipc_monitoring/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">工控机监控</string>
|
||||
</resources>
|
||||
20
app_ipc_monitoring/src/main/res/values/styles.xml
Normal file
20
app_ipc_monitoring/src/main/res/values/styles.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">#224b8f</item>
|
||||
<item name="colorPrimaryDark">@color/colorBlue</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
<item name="android:windowBackground">@android:color/white</item>
|
||||
<item name="android:windowEnableSplitTouch">false</item>
|
||||
<item name="android:splitMotionEvents">false</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<base-config cleartextTrafficPermitted="true" />
|
||||
</network-security-config>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zhidao.adas.client;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
* 当前协议使用的版本
|
||||
*/
|
||||
private static final int PROTOCOL_VERSION = MessagePad.ProtocolVersion.CurrentVersion.getNumber();
|
||||
public static final String AP_VERSION = BuildConfig.AP_VERSION;
|
||||
private static final String AP_VERSION = BuildConfig.AP_VERSION;
|
||||
|
||||
public static AdasManager getInstance() {
|
||||
if (ourInstance == null) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
rootProject.name = 'MoGoEagleEye'
|
||||
include ':app'
|
||||
include ':app_ipc_monitoring'
|
||||
|
||||
|
||||
// 核心模块
|
||||
|
||||
Reference in New Issue
Block a user