merge qa_aiSdk

This commit is contained in:
zhongchao
2021-04-23 15:57:39 +08:00
20 changed files with 256 additions and 277 deletions

View File

@@ -1,6 +1,7 @@
package com.mogo.module.common.uploadintime;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.realtime.entity.CloudLocationInfo;
import com.mogo.utils.logger.Logger;
@@ -98,6 +99,7 @@ class SnapshotLocationController {
cloudLocationInfo.setSpeed( speed );
cloudLocationInfo.setSatelliteTime( satelliteTime );
cloudLocationInfo.setSystemTime( systemTime );
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon,lat)));
mLastLocationInfo = cloudLocationInfo;
mMachineCacheList.add( cloudLocationInfo );

View File

@@ -8,6 +8,7 @@ import android.location.LocationManager;
import android.os.Bundle;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.uploadintime.SnapshotLocationController;
import com.mogo.realtime.entity.CloudLocationInfo;
import com.mogo.utils.logger.Logger;
@@ -29,77 +30,79 @@ public class MogoRTKLocation {
}
public void init() {
locationManager = ( LocationManager ) AbsMogoApplication.getApp().getApplicationContext().getSystemService( Context.LOCATION_SERVICE );
String provider = locationManager.getBestProvider( getCriteria(), true );
Logger.d( TAG, "init provider : " + provider );
if ( locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) {
locationManager = (LocationManager) AbsMogoApplication.getApp().getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
String provider = locationManager.getBestProvider(getCriteria(), true);
Logger.d(TAG, "init provider : " + provider);
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
try {
locationManager.requestLocationUpdates( provider, 0, 0, locationListener );
Location location = locationManager.getLastKnownLocation( provider );
if ( location != null ) {
Logger.i( TAG, "location : " + location.toString() );
locationManager.requestLocationUpdates(provider, 0, 0, locationListener);
Location location = locationManager.getLastKnownLocation(provider);
if (location != null) {
Logger.i(TAG, "location : " + location.toString());
}
} catch ( Exception e ) {
} catch (Exception e) {
e.printStackTrace();
Logger.d( TAG, "RTK LocationManager requestLocationUpdates has Exception : " + e.getMessage() );
Logger.d(TAG, "RTK LocationManager requestLocationUpdates has Exception : " + e.getMessage());
}
} else {
Logger.d( TAG, "RTK LocationManager Provider GPS_PROVIDER unable" );
Logger.d(TAG, "RTK LocationManager Provider GPS_PROVIDER unable");
}
}
private Criteria getCriteria() {
Criteria criteria = new Criteria();
criteria.setAccuracy( Criteria.ACCURACY_FINE ); //高精
criteria.setAltitudeRequired( false );
criteria.setBearingRequired( true );
criteria.setSpeedRequired( true );
criteria.setPowerRequirement( Criteria.POWER_LOW );
criteria.setAccuracy(Criteria.ACCURACY_FINE); //高精
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(true);
criteria.setSpeedRequired(true);
criteria.setPowerRequirement(Criteria.POWER_LOW);
return criteria;
}
private final LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged( Location location ) {
if ( location != null ) {
public void onLocationChanged(Location location) {
if (location != null) {
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
if(location.getLatitude() != 0.0 && location.getLongitude() != 0.0){
cloudLocationInfo.setAlt( location.getAltitude() );
cloudLocationInfo.setHeading( location.getBearing() );
cloudLocationInfo.setLat( location.getLatitude() );
cloudLocationInfo.setLon( location.getLongitude() );
cloudLocationInfo.setSpeed( location.getSpeed() );
cloudLocationInfo.setSatelliteTime( location.getTime() );
cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
SnapshotLocationController.getInstance().syncLocationInfo( cloudLocationInfo );
if (location.getLatitude() != 0.0 && location.getLongitude() != 0.0) {
cloudLocationInfo.setAlt(location.getAltitude());
cloudLocationInfo.setHeading(location.getBearing());
cloudLocationInfo.setLat(location.getLatitude());
cloudLocationInfo.setLon(location.getLongitude());
cloudLocationInfo.setSpeed(location.getSpeed());
cloudLocationInfo.setSatelliteTime(location.getTime());
cloudLocationInfo.setSystemTime(System.currentTimeMillis());
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
.getTileId(location.getLongitude(), location.getLatitude())));
SnapshotLocationController.getInstance().syncLocationInfo(cloudLocationInfo);
}
} else {
Logger.e( TAG, "location == null" );
Logger.e(TAG, "location == null");
}
}
@Override
public void onStatusChanged( String provider, int status, Bundle extras ) {
Logger.d( TAG, "onStatusChanged status: " + status );
public void onStatusChanged(String provider, int status, Bundle extras) {
Logger.d(TAG, "onStatusChanged status: " + status);
}
@Override
public void onProviderEnabled( String provider ) {
Logger.d( TAG, "onProviderEnabled" );
public void onProviderEnabled(String provider) {
Logger.d(TAG, "onProviderEnabled");
}
@Override
public void onProviderDisabled( String provider ) {
Logger.d( TAG, "onProviderEnabled" );
public void onProviderDisabled(String provider) {
Logger.d(TAG, "onProviderEnabled");
}
};
public void stop() {
Logger.d( TAG, "stop RTK Location" );
if ( locationManager != null && locationListener != null ) {
locationManager.removeUpdates( locationListener );
Logger.d(TAG, "stop RTK Location");
if (locationManager != null && locationListener != null) {
locationManager.removeUpdates(locationListener);
} else {
Logger.d( TAG, "stop failed , reason : loc" + locationManager + " , or loc listener: " + locationListener + " is null" );
Logger.d(TAG, "stop failed , reason : loc" + locationManager + " , or loc listener: " + locationListener + " is null");
}
}
}

View File

@@ -9,7 +9,7 @@ import com.mogo.module.v2x.listener.V2XMessageListener_401009;
import com.mogo.module.v2x.listener.V2XMessageListener_401010;
import com.mogo.module.v2x.listener.V2XMessageListener_401011;
import com.mogo.module.v2x.listener.V2XMessageListener_401012;
import com.mogo.module.v2x.listener.V2XMessageListener_401019;
import com.mogo.module.v2x.listener.V2XMessageListener_401020;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -33,7 +33,7 @@ public class V2XSocketManager {
private V2XMessageListener_401007 v2XMessageListener_401007;
private V2XMessageListener_401009 v2XMessageListener_401009;
private V2XMessageListener_401010 v2XMessageListener_401010;
private V2XMessageListener_401019 v2XMessageListener_401019;
private V2XMessageListener_401020 mV2XMessageListener_401020;
private V2XSocketManager() {
@@ -112,10 +112,10 @@ public class V2XSocketManager {
.getMoGoSocketManager()
.unregisterOnMessageListener(401009, v2XMessageListener_401009);
}
if (v2XMessageListener_401019 != null) {
if (mV2XMessageListener_401020 != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(401019, v2XMessageListener_401019);
.unregisterOnMessageListener(401019, mV2XMessageListener_401020);
}
}
@@ -231,13 +231,13 @@ public class V2XSocketManager {
* * 最优路线推荐
*/
public void register401019() {
v2XMessageListener_401019 = new V2XMessageListener_401019();
mV2XMessageListener_401020 = new V2XMessageListener_401020();
// 道路事件,在线车辆绘制
V2XServiceManager
.getMoGoSocketManager()
.registerOnMessageListener(
401019,
v2XMessageListener_401019
401020,
mV2XMessageListener_401020
);
}

View File

@@ -21,7 +21,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* @description 车路云场景预警-云下发数据监听 最优路线推荐
* @since: 2021/4/13
*/
public class V2XMessageListener_401019 implements IMogoOnMessageListener<V2XOptimalRouteDataRes> {
public class V2XMessageListener_401020 implements IMogoOnMessageListener<V2XOptimalRouteDataRes> {
@Override
public Class target() {
return V2XOptimalRouteDataRes.class;
@@ -29,7 +29,7 @@ public class V2XMessageListener_401019 implements IMogoOnMessageListener<V2XOpti
@Override
public void onMsgReceived(V2XOptimalRouteDataRes message) {
Logger.i(MODULE_NAME, "V2XMessageListener_401019" + message);
Logger.i(MODULE_NAME, "V2XMessageListener_401020" + message);
// 将接收到的数据转换成最优车道推荐的场景数据
if (message != null

View File

@@ -55,7 +55,7 @@ public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
: R.layout.window_see_carlive_video, this);
CarZegoLiveVideoView mV2XCarLiveVideoView = findViewById(R.id.videoPlayer);
tvCountDown = findViewById(R.id.tvCountDown);
ImageView ivLiveVideoClose = findViewById(R.id.liveVideoClose);
// ImageView ivLiveVideoClose = findViewById(R.id.liveVideoClose);
ivVideoPlayingSign = findViewById(R.id.ivVideoPlayingSign);
mV2XCarLiveVideoView.addOnVideoStatusChangeListener(videoPlaying -> {
isVideoPlay = videoPlaying;
@@ -65,7 +65,7 @@ public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
stopCountDown();
}
});
ivLiveVideoClose.setOnClickListener(v -> close());
// ivLiveVideoClose.setOnClickListener(v -> close());
}
@Override

View File

@@ -109,8 +109,6 @@ public class CarZegoLiveVideoView extends RoundLayout {
if (!TextUtils.isEmpty(liveSn)) {
CarZegoLiveVideoView.this.liveSn = liveSn;
}
mLoading.setVisibility(VISIBLE);
mClLoadError.setVisibility(GONE);
refreshStatusToListener(true);
mLoading.setVisibility(GONE);
mClLoadError.setVisibility(GONE);

View File

@@ -121,7 +121,7 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
/**
* 开始直播
*
* @param carLiveInfo 直播的车机,如果没有直播的地址需要重新获取最新的直播地址
* @param carLiveInfo 直播数据
*/
public void startLive(MarkerCarInfo.CarLiveInfo carLiveInfo) {
// 进行直播播放
@@ -131,36 +131,6 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
setCarLiveInfo(carLiveInfo);
playLiveVideo(carLiveInfo);
}
// 根据SN重新获取直播流地址
else {
// V2XServiceManager
// .getV2XRefreshModel()
// .livePush(new V2XRefreshCallback<V2XLivePushVoRes>() {
// @Override
// public void onSuccess(V2XLivePushVoRes result) {
// Logger.e(MODULE_NAME, "从服务端获取最新直播信息:" + GsonUtil.jsonFromObject(result));
// mClLoadError.setVisibility(GONE);
// mClLoadError.setVisibility(GONE);
// try {
// MarkerCarInfo.CarLiveInfo carRealLiveInfo = new MarkerCarInfo.CarLiveInfo();
// carRealLiveInfo.setVideoUrl(result.getResult().getPlayUrl().getRtmp());
// carRealLiveInfo.setVideoSn(carLiveInfo.getVideoSn());
// carRealLiveInfo.setVideoChannel(result.getResult().getVideoChannel());
// setCarLiveInfo(carLiveInfo);
// playLiveVideo(carRealLiveInfo);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// @Override
// public void onFail(String msg) {
// Logger.e(MODULE_NAME, "播放器:" + msg);
// mLoading.setVisibility(GONE);
// mClLoadError.setVisibility(VISIBLE);
// }
// }, carLiveInfo.getVideoSn(), 0);
}
}
}
@@ -212,26 +182,6 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
}
}
/**
* 刷新直播心跳
*
* @param carLiveInfo 直播info
*/
private void startHeartLive(MarkerCarInfo.CarLiveInfo carLiveInfo) {
try {
if (carLiveInfo != null && !TextUtils.isEmpty(carLiveInfo.getVideoSn())
&& !TextUtils.isEmpty(carLiveInfo.getVideoChannel())) {
V2XServiceManager
.getV2XRefreshModel()
.refreshHeartBeat(carLiveInfo.getVideoSn(),
carLiveInfo.getVideoChannel(),
null);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void stopLive(MarkerCarInfo.CarLiveInfo carLiveInfo) {
try {
Logger.w(MODULE_NAME, "心跳:关闭直播...");

View File

@@ -30,8 +30,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone"
tools:visibility="visible">
android:visibility="gone">
<ImageView
android:id="@+id/ivErrorIcon"

View File

@@ -20,5 +20,6 @@
android:layout_marginTop="@dimen/dp_20"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
android:src="@drawable/module_v2x_vr_close" />
</RelativeLayout>

View File

@@ -20,6 +20,7 @@
android:layout_marginTop="@dimen/dp_20"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
android:src="@drawable/module_v2x_vr_close" />
</RelativeLayout>