Merge branch 'dev_robobus-d_230413_3.1.0' into dev_robobus_gradle_och_230317

# Conflicts:
#	app/productFlavors/ochDriverM1.gradle
This commit is contained in:
yangyakun
2023-04-19 11:07:14 +08:00
14 changed files with 225 additions and 34 deletions

View File

@@ -54,7 +54,7 @@
"socket_tech_url": "https://och-driver-eh.zhidaozhixing.com/arch/",
"eagle_mis_url": "https://och-hailing-eh.zhidaozhixing.com/",
"eagle_dns_url": "https://och-hailing-eh.zhidaozhixing.com/",
"bind_driver_qr_url": "https://tech.zhidaohulian.com?pipe=ehsafety&sn=%1$s",
"bind_driver_qr_url": "https://och-mini-eh.zhidaozhixing.com?pipe=ehsafety&sn=%1$s",
"chart_socket_url":"wss://acp-eh.zhidaozhixing.com/ws"
},
"demo": {
@@ -89,7 +89,7 @@
"socket_tech_url": "https://och-driver-yt.zhidaozhixing.com/arch/",
"eagle_mis_url": "https://och-hailing-yt.zhidaozhixing.com/",
"eagle_dns_url": "https://och-hailing-yt.zhidaozhixing.com/",
"bind_driver_qr_url": "https://tech.zhidaohulian.com?pipe=ytsafety&sn=%1$s",
"bind_driver_qr_url": "https://och-mini-yt.zhidaozhixing.com?pipe=ytsafety&sn=%1$s",
"chart_socket_url":""
},
"demo": {

View File

@@ -8,6 +8,7 @@ import android.widget.ProgressBar
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.hmi.R
@@ -37,6 +38,8 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
private var isConfirm = true
private var isRetry = false
var location: MogoLocation? = null
init {
setContentView(R.layout.dialog_offline_map)
setCanceledOnTouchOutside(true)
@@ -89,8 +92,8 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
}
}
private fun cacheHDOfflineData() {
CallerMapUIServiceManager.cacheHDDataByCity(object : IHdCacheListener {
private fun cacheHDDataByCityByLonLat() {
CallerMapUIServiceManager.cacheHDDataByCityByLonLat(object : IHdCacheListener {
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
updateProgress(progress.toInt())
}
@@ -100,7 +103,25 @@ class OfflineMapDialog(context: Context): BaseFloatDialog(context) {
showNewContent(isLoading = false, false)
}
}
})
}, location!!)
}
private fun cacheHDOfflineData() {
if (location == null) {// 拿到了高德地图的cityCode
CallerMapUIServiceManager.cacheHDDataByCity(object : IHdCacheListener {
override fun onMapHdCacheProgress(cityId: Int, progress: Double) {
updateProgress(progress.toInt())
}
override fun onMapHdCacheResult(cityId: Int, state: Int) {
if (state == 0) {// 失败
showNewContent(isLoading = false, false)
}
}
})
} else {// 只拿到了高精的经纬度
cacheHDDataByCityByLonLat()
}
}
@SuppressLint("SetTextI18n")

View File

@@ -70,7 +70,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
}
override fun onDataChanged(category: MsgCategory, msgBoxBean: MsgBoxBean) {
UiThreadHandler.post {
UiThreadHandler.post({
when (category) {
MsgCategory.NOTICE -> {
MsgBoxConfig.noticeList.add(msgBoxBean)
@@ -98,7 +98,7 @@ class DriverMsgBoxBubbleView @JvmOverloads constructor(
driverMsgBoxBubbleAdapter?.setData(dataList)
}
}
}
}, UiThreadHandler.MODE.QUEUE)
}
override fun onAttachedToWindow() {

View File

@@ -57,7 +57,7 @@ class TakeOverView @JvmOverloads constructor(
autopilotStatus = autoPilotStatusInfo.state
if(autoPilotStatusInfo.state == 7){
isParallel = true
}else if(autoPilotStatusInfo.state == 2){
}else if(autoPilotStatusInfo.state == 0 || autoPilotStatusInfo.state == 1){
isParallel = false
}
Log.i(TAG,"自动驾驶状态${autopilotStatus}")
@@ -113,7 +113,7 @@ class TakeOverView @JvmOverloads constructor(
MogoReport.Code.Error.EMAP.EPARALLEL_AICLOUD_CONNECTION_ERROR -> {
//如果是平行驾驶状态下,提示弱网接管
Log.i(TAG,"弱网时自动驾驶状态:${autopilotStatus}")
if(autopilotStatus == 7 || isParallel){
if(isParallel){
CallerHmiManager.warningV2X(
EventTypeEnumNew.NETWORK_WEAK_EVENT.poiType,
EventTypeEnumNew.NETWORK_WEAK_EVENT.content,

View File

@@ -8,10 +8,13 @@ import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.deva.bindingcar.AdUpgradeStateHelper
import com.mogo.eagle.core.data.deva.bindingcar.IPCUpgradeStateInfo
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener
import com.mogo.eagle.core.function.api.hmi.autopilot.IMoGoCheckAutoPilotBtnListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
@@ -37,7 +40,7 @@ class SystemVersionView @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener,
IMoGoDevaToolsListener, IMoGoCheckAutoPilotBtnListener {
IMoGoDevaToolsListener, IMoGoCheckAutoPilotBtnListener, IMoGoChassisLocationWGS84Listener {
companion object {
const val TAG = "SystemVersionView"
@@ -55,6 +58,7 @@ class SystemVersionView @JvmOverloads constructor(
private var currentProgress: Int = -1 //当前已下载包体大小
private var isHDCached = false
private var location: MogoLocation? = null
init {
LayoutInflater.from(context).inflate(R.layout.view_system_version, this, true)
@@ -137,7 +141,17 @@ class SystemVersionView @JvmOverloads constructor(
if (isHDCached) {// 已缓存
ToastUtils.showShort(resources.getString(R.string.offline_had_downloaded))
} else {// 未缓存
OfflineMapDialog(context).show()
if (CallerMapUIServiceManager.getCityCode().isNullOrEmpty()) {// 未拿到高德的cityCode
if (location == null || (location!!.longitude <= 0.0 && location!!.latitude <= 0.0)) {// 未拿到高精的经纬度
ToastUtils.showShort(resources.getString(R.string.location_try_again))
} else {// 拿到了高精的经纬度
val dialog = OfflineMapDialog(context)
dialog.location = location
dialog.show()
}
} else {// 拿到高德的cityCode
OfflineMapDialog(context).show()
}
}
}
@@ -292,6 +306,7 @@ class SystemVersionView @JvmOverloads constructor(
CallerHmiListenerManager.addListener(TAG, this)
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
CallerDevaToolsListenerManager.addListener(TAG,this)
CallerChassisLocationWGS84ListenerManager.addListener(TAG, this)
needQueryContainers = true
}
@@ -303,6 +318,7 @@ class SystemVersionView @JvmOverloads constructor(
CallerHmiListenerManager.removeListener(TAG)
CallerAutoPilotStatusListenerManager.removeListener(TAG)
CallerDevaToolsListenerManager.removeListener(TAG)
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
needQueryContainers = false
}
@@ -361,4 +377,7 @@ class SystemVersionView @JvmOverloads constructor(
adCircularProgressView?.visibility = View.GONE
}
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
location = gnssInfo
}
}

View File

@@ -75,6 +75,7 @@
<string name="offline_download_success">离线地图下载成功</string>
<string name="offline_download_failure">离线地图下载失败</string>
<string name="offline_had_downloaded">当前已为最新版本</string>
<string name="location_try_again">请检查定位是否正常</string>
<string name="ok_tip">确定</string>
<string name="retry">重试</string>
</resources>

View File

@@ -52,10 +52,11 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
private var context: Context? = null
@Volatile
private var gotToken = false
private var httpDnsSimpleLocation by Delegates.observable(getDefaultSimpleLocation()) { _, oldValue, newValue ->
if (oldValue.cityCode != newValue.cityCode) {
if (gotToken && oldValue.cityCode != newValue.cityCode) {
reConnectSocket(oldValue.cityCode, newValue.cityCode)
}
}

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.call.map
import android.content.Context
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.map.IMogoMapService
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService
import com.mogo.eagle.core.function.call.base.CallerBase
@@ -35,6 +36,10 @@ object CallerMapUIServiceManager {
serviceProvider?.mapUIController?.cacheHDDataByCity(listener)
}
fun cacheHDDataByCityByLonLat(listener: IHdCacheListener, location: MogoLocation) {
serviceProvider?.mapUIController?.cacheHDDataByCity(listener, location)
}
fun isCityDataCached(): Boolean {
return serviceProvider?.mapUIController?.isCityDataCached ?: false
}
@@ -50,4 +55,8 @@ object CallerMapUIServiceManager {
fun cancelDownloadCacheData() {
serviceProvider?.mapUIController?.cancelDownloadCacheData()
}
fun getCityCode(): String? {
return serviceProvider?.mapUIController?.cityCode
}
}

View File

@@ -53,6 +53,18 @@ public final class ThreadUtils {
private static Executor sDeliver;
public enum MODE {
/**
* 多次post同一个Runnable对象只会执行最后一次
*/
LATEST,
/**
* 多次post在主线程消息队列中排队执行
*/
QUEUE
}
/**
* Return whether the thread is the main thread.
*
@@ -63,23 +75,40 @@ public final class ThreadUtils {
}
public static void runOnUiThread(final Runnable r) {
runOnUiThread(r, MODE.LATEST);
}
public static void runOnUiThread(final Runnable r, MODE mode) {
if (Looper.myLooper() == Looper.getMainLooper()) {
r.run();
} else {
int what = ObjectHashCodeUtils.getHashCodeIfNeed(r);
HANDLER.removeMessages(what);
Message msg = Message.obtain(HANDLER, r);
msg.what = what;
HANDLER.sendMessage(msg);
if (mode == MODE.LATEST) {
int what = ObjectHashCodeUtils.getHashCodeIfNeed(r);
HANDLER.removeMessages(what);
Message msg = Message.obtain(HANDLER, r);
msg.what = what;
HANDLER.sendMessage(msg);
} else {
HANDLER.post(r);
}
}
}
public static void runOnUiThreadDelayed(final Runnable r, long delayMillis) {
int what = ObjectHashCodeUtils.getHashCodeIfNeed(r);
HANDLER.removeMessages(what);
Message msg = Message.obtain(HANDLER, r);
msg.what = what;
HANDLER.sendMessageDelayed(msg, delayMillis);
runOnUiThreadDelayed(r, delayMillis, MODE.LATEST);
}
public static void runOnUiThreadDelayed(final Runnable r, long delayMillis, MODE mode) {
if (mode == MODE.LATEST) {
int what = ObjectHashCodeUtils.getHashCodeIfNeed(r);
HANDLER.removeMessages(what);
Message msg = Message.obtain(HANDLER, r);
msg.what = what;
HANDLER.sendMessageDelayed(msg, delayMillis);
} else {
HANDLER.postDelayed(r, delayMillis);
}
}
/**

View File

@@ -10,24 +10,58 @@ public class UiThreadHandler {
private UiThreadHandler() { }
public enum MODE {
/**
* 多次post同一个Runnable对象只会执行最后一次
*/
LATEST,
/**
* 多次post在主线程消息队列中排队执行
*/
QUEUE
}
public static boolean post( Runnable r ) {
int what = ObjectHashCodeUtils.getHashCodeIfNeed(r);
sUiHandler.removeMessages(what);
Message msg = Message.obtain(sUiHandler, r);
msg.what = what;
return sUiHandler.sendMessage(msg);
return post(r, MODE.LATEST);
}
public static boolean post(Runnable r, MODE mode) {
if (mode == MODE.LATEST) {
int what = ObjectHashCodeUtils.getHashCodeIfNeed(r);
sUiHandler.removeMessages(what);
Message msg = Message.obtain(sUiHandler, r);
msg.what = what;
return sUiHandler.sendMessage(msg);
}
return sUiHandler.post(r);
}
public static boolean postDelayed( Runnable r, long delayMillis ) {
int what = ObjectHashCodeUtils.getHashCodeIfNeed(r);
sUiHandler.removeMessages(what);
Message msg = Message.obtain(sUiHandler, r);
msg.what = what;
return sUiHandler.sendMessageDelayed(msg, delayMillis);
return postDelayed(r, delayMillis, MODE.LATEST);
}
public static boolean postDelayed( Runnable r, long delayMillis, MODE mode ) {
if (mode == MODE.LATEST) {
int what = ObjectHashCodeUtils.getHashCodeIfNeed(r);
sUiHandler.removeMessages(what);
Message msg = Message.obtain(sUiHandler, r);
msg.what = what;
return sUiHandler.sendMessageDelayed(msg, delayMillis);
}
return sUiHandler.postDelayed(r, delayMillis);
}
public static void removeCallbacks( Runnable r ) {
int what = ObjectHashCodeUtils.getHashCodeIfNeed(r);
sUiHandler.removeMessages(what);
removeCallbacks(r, MODE.LATEST);
}
public static void removeCallbacks( Runnable r, MODE mode ) {
if (mode == MODE.LATEST) {
int what = ObjectHashCodeUtils.getHashCodeIfNeed(r);
sUiHandler.removeMessages(what);
} else {
sUiHandler.removeCallbacks(r);
}
}
}

View File

@@ -360,6 +360,8 @@ public interface IMogoMapUIController {
void setPointCloudColor(String color);
void cacheHDDataByCity(IHdCacheListener listener);
void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location);
/**
* 当前城市离线数据是否已缓存
* @return
@@ -367,4 +369,6 @@ public interface IMogoMapUIController {
boolean isCityDataCached();
void cancelDownloadCacheData();
String getCityCode();
}

View File

@@ -1075,6 +1075,44 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
@Override
public void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location) {
if (mMapView.getMapAutoViewHelper() != null) {
hdCacheListener = listener;
mMapView.getMapAutoViewHelper().cacheHDDataByCityByLonLat(location.getLongitude(), location.getLatitude(), new OnHdDataDownByCityListener() {
@Override
public void onMapHDDataCacheProgressByCity(int cityId, double progress) {
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
if (hdCacheListener != null) {
hdCacheListener.onMapHdCacheProgress(cityId, progress * 100);
}
} else {
UiThreadHandler.post(() -> {
if (hdCacheListener != null) {
hdCacheListener.onMapHdCacheProgress(cityId, progress * 100);
}
});
}
}
@Override
public void onMapHDDataCacheStateByCity(int i, int state) {// 0失败1成功
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
if (hdCacheListener != null) {
hdCacheListener.onMapHdCacheResult(i, state);
}
} else {
UiThreadHandler.post(() -> {
if (hdCacheListener != null) {
hdCacheListener.onMapHdCacheResult(i, state);
}
});
}
}
});
}
}
@Override
public boolean isCityDataCached() {
if (mMapView.getMapAutoViewHelper() != null) {
@@ -1100,4 +1138,9 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.getMapAutoViewHelper().cancelCacheHDData();
}
}
@Override
public String getCityCode() {
return GDLocationClient.getInstance(getContext()).getLastCityCode();
}
}

View File

@@ -468,6 +468,13 @@ public class MogoMapUIController implements IMogoMapUIController {
}
}
@Override
public void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location) {
if (mDelegate != null) {
mDelegate.cacheHDDataByCity(listener, location);
}
}
@Override
public boolean isCityDataCached() {
if (mDelegate != null) {
@@ -482,4 +489,12 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.cancelDownloadCacheData();
}
}
@Override
public String getCityCode() {
if (mDelegate != null) {
return mDelegate.getCityCode();
}
return null;
}
}

View File

@@ -406,6 +406,13 @@ public class AMapUIController implements IMogoMapUIController {
}
}
@Override
public void cacheHDDataByCity(IHdCacheListener listener, MogoLocation location) {
if (mClient != null) {
mClient.cacheHDDataByCity(listener, location);
}
}
@Override
public boolean isCityDataCached() {
if (mClient != null) {
@@ -420,4 +427,12 @@ public class AMapUIController implements IMogoMapUIController {
mClient.cancelDownloadCacheData();
}
}
@Override
public String getCityCode() {
if (mClient != null) {
return mClient.getCityCode();
}
return null;
}
}