diff --git a/.gitignore b/.gitignore index c453264..b3f6ed4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,9 @@ *.iml .gradle /local.properties -/.idea/caches -/.idea/libraries -/.idea/modules -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml .DS_Store /build /captures .externalNativeBuild .cxx -/.idea/modules/ +.idea/ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 88ea3aa..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - -
- - - - xmlns:android - - ^$ - - - -
-
- - - - xmlns:.* - - ^$ - - - BY_NAME - -
-
- - - - .*:id - - http://schemas.android.com/apk/res/android - - - -
-
- - - - .*:name - - http://schemas.android.com/apk/res/android - - - -
-
- - - - name - - ^$ - - - -
-
- - - - style - - ^$ - - - -
-
- - - - .* - - ^$ - - - BY_NAME - -
-
- - - - .* - - http://schemas.android.com/apk/res/android - - - ANDROID_ATTRIBUTE_ORDER - -
-
- - - - .* - - .* - - - BY_NAME - -
-
-
-
- - -
-
\ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index fb7f4a8..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/dictionaries/zhongchao.xml b/.idea/dictionaries/zhongchao.xml deleted file mode 100644 index 6d1b40d..0000000 --- a/.idea/dictionaries/zhongchao.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - amap - coor - designative - mogo - tongchenfei - - - \ No newline at end of file diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml deleted file mode 100644 index b382006..0000000 --- a/.idea/git_toolbox_prj.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 5da1e76..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index bac8f7b..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index bb43490..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index cd31019..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 3397f87..8744c96 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -62,11 +62,13 @@ dependencies { implementation "com.mogo.cloud:tanlu:${MOGO_TANLU_VERSION}" implementation "com.mogo.cloud:realtime:${MOGO_REALTIME_VERSION}" implementation "com.mogo.cloud:trafficlive:${MOGO_TRAFFICLIVE_VERSION}" + implementation "com.mogo.v2x:v2x:${MOGO_V2X_VERSION}" } else { implementation project(":foudations:mogo-location") implementation project(":modules:mogo-tanlu") implementation project(":modules:mogo-realtime") implementation project(":modules:mogo-trafficlive") + implementation project(":foudations:mogo-v2x") } annotationProcessor 'com.elegant.spi:compiler:1.0.3' //编译时库 diff --git a/app/src/main/java/com/mogo/cloud/MainActivity.java b/app/src/main/java/com/mogo/cloud/MainActivity.java index cdca13b..d8be4fe 100644 --- a/app/src/main/java/com/mogo/cloud/MainActivity.java +++ b/app/src/main/java/com/mogo/cloud/MainActivity.java @@ -4,18 +4,27 @@ import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.view.SurfaceView; +import android.view.View; import android.widget.Button; import android.widget.TextView; +import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import com.elegant.log.simplelog.Logger; import com.mogo.cloud.network.NetworkActivity; import com.mogo.cloud.passport.IMoGoTokenCallback; import com.mogo.cloud.passport.MoGoAiCloudClient; +import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.cloud.trafficlive.api.ITrafficCarLiveCallBack; import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack; import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive; +import com.mogo.v2x.V2XManager; +import com.mogo.v2x.callback.IV2XCallback; +import com.mogo.v2x.config.V2XConfig; +import com.mogo.v2x.event.V2XEvent; + +import java.util.concurrent.TimeUnit; public class MainActivity extends AppCompatActivity { @@ -32,6 +41,9 @@ public class MainActivity extends AppCompatActivity { private Button btnJumpLivePlay; private Button btnRequestXINGLive; private Button btnRequestCarLive; + private Button btnV2XFunctionTest; + + private boolean v2xHasBeenInitialized = false; private SurfaceView surfacePreviewView; private TextView tvSn; @@ -192,9 +204,62 @@ public class MainActivity extends AppCompatActivity { }); }); + //V2X功能测试 + btnV2XFunctionTest = findViewById(R.id.btnV2XFunctionTest); + btnV2XFunctionTest.setOnClickListener(v -> { + if (v2xHasBeenInitialized) { + return; + } + v2xHasBeenInitialized = true; + V2XConfig.Builder builder = new V2XConfig.Builder(); + builder.loggable(true) + .aiCloudConfig(MoGoAiCloudClientConfig.getInstance()) + .appId("com.mogo.launcher") + .context(v.getContext()) + .distanceForTriggerRefresh(300) + .durationForTriggerRefresh(1, TimeUnit.MINUTES); + V2XManager.INSTANCE.init(builder.build()); + V2XManager.INSTANCE.addCallback(new IV2XCallback() { + @Override + public void onAck(@NonNull V2XEvent event) { + if (event instanceof V2XEvent.ForwardsWarning) { + V2XEvent.ForwardsWarning warning = (V2XEvent.ForwardsWarning) event; + Logger.d("V2XManager", "forward-warning<->onAck::" + warning.toString()); + } + if (event instanceof V2XEvent.OptimalRoute) { + V2XEvent.OptimalRoute route = (V2XEvent.OptimalRoute) event; + Logger.d("V2XManager", "route<->onAck::" + route.toString()); + } + + if (event instanceof V2XEvent.Warning) { + V2XEvent.Warning warning = (V2XEvent.Warning) event; + Logger.d("V2XManager", "warning<->onAck::" + warning.toString()); + } + + if (event instanceof V2XEvent.Road) { + V2XEvent.Road road = (V2XEvent.Road) event; + Logger.d("V2XManager", "road<-->onAck::" + road.toString()); + } + + if (event instanceof V2XEvent.Marker) { + V2XEvent.Marker marker = (V2XEvent.Marker) event; + Logger.d("V2XManager", "marker<-->onAck::" + marker.toString()); + } + } + + @Override + public void onFail(@NonNull String s) { + Logger.d("V2XManager", "onFail::" + s); + } + }); + }); + MoGoAiCloudClient.getInstance().addTokenCallbacks(new IMoGoTokenCallback() { @Override public void onTokenGot(String token, String sn) { + if (btnV2XFunctionTest.getVisibility() != View.VISIBLE) { + btnV2XFunctionTest.setVisibility(View.VISIBLE); + } initPassportInfo(); } diff --git a/app/src/main/java/com/mogo/cloud/MoGoApplication.java b/app/src/main/java/com/mogo/cloud/MoGoApplication.java index 5f93c51..aa80399 100644 --- a/app/src/main/java/com/mogo/cloud/MoGoApplication.java +++ b/app/src/main/java/com/mogo/cloud/MoGoApplication.java @@ -11,6 +11,7 @@ import com.mogo.cloud.httpdns.MogoHttpDnsClient; import com.mogo.cloud.httpdns.MogoHttpDnsConfig; import com.mogo.cloud.httpdns.bean.HttpDnsSimpleLocation; import com.mogo.cloud.httpdns.listener.IHttpDnsCurrentLocation; +import com.mogo.cloud.location.LocationManager; import com.mogo.cloud.passport.IMoGoTokenCallback; import com.mogo.cloud.passport.MoGoAiCloudClient; import com.mogo.cloud.passport.MoGoAiCloudClientConfig; diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 5ad8b0a..6148872 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -112,6 +112,12 @@ android:text="查看周边可直播车" android:visibility="visible" /> +