Merge remote-tracking branch 'origin/live_sdk' into live_sdk

This commit is contained in:
董宏宇
2021-02-04 18:49:21 +08:00
14 changed files with 61 additions and 62 deletions

1
.idea/gradle.xml generated
View File

@@ -26,6 +26,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -0,0 +1 @@
-keep class com.zhidao.ptech.shadow.server.protocol.DeviceInfo{*;}

View File

@@ -4,8 +4,12 @@ import com.mogo.cloud.live.model.BaseData;
import com.mogo.cloud.live.model.LiveStatusInfo;
import com.mogo.cloud.live.model.StartCarAlarmInfo;
import java.util.Map;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import rx.Observable;
@@ -31,4 +35,21 @@ public interface LiveApiServer {
@POST("/alarm/car/video/reportCameraStatus")
Observable<BaseData> uploadCamStatus(@Body RequestBody body);
/**
* 获取车辆前方直播Url
* @param vehicleHeadLiveMap 请求数据
* @return {@link BaseData}
*/
@FormUrlEncoded
@POST("")
Observable<BaseData> getVehicleHeadLive(@FieldMap Map<String, String> vehicleHeadLiveMap);
/**
* 获取前方路口直播Url
* @param intersectionLiveMap 请求数据
* @return {@link BaseData}
*/
@FormUrlEncoded
@POST("")
Observable<BaseData> getIntersectionLive(@FieldMap Map<String, String> intersectionLiveMap);
}

View File

@@ -30,16 +30,16 @@ import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_DEMO;
import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_DEV;
import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_QA;
import static com.mogo.cloud.httpdns.MogoHttpDnsConfig.HTTP_DNS_ENV_RELEASE;
import static com.mogo.cloud.socket.SocketServicesConstants.TAG;
/**
* Socket 长链核心服务
*/
public class SocketManager implements IMogoCloudSocketManager, Callback {
private static final String TAG = "SocketManager";
private static volatile SocketManager mInstance;
private MoGoAiCloudClientConfig cloudClientConfig;
private String mAppId;
private SocketManager() {
CallbackManager.getInstance().register(this);

View File

@@ -4,6 +4,8 @@ import androidx.annotation.Keep;
public class SocketServicesConstants {
public static final String TAG = "MoGoAiCloud_Socket";
/**
* 建立长链的通道ID
*/

View File

@@ -2,5 +2,5 @@ package com.mogo.realtime.constant;
public class RealTimeConstant {
public static final String TAG = "MoGoAiCloudRealTime";
public static final String TAG = "MoGoAiCloud_RealTime";
}

View File

@@ -46,7 +46,7 @@ public class MogoRTKLocation {
Logger.e(TAG, "暂无定位数据");
return list;
}
}else{
} else {
cacheList.clear();
}
return list;
@@ -58,28 +58,20 @@ public class MogoRTKLocation {
public void init() {
locationManager = (LocationManager) MoGoAiCloudClient.getInstance().getContext().getSystemService(Context.LOCATION_SERVICE);
String provider = locationManager.getBestProvider(getCriteria(), true);
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Logger.d(TAG, "init provider : " + provider);
}
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) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Logger.i(TAG, "location : " + location.toString());
}
Logger.i(TAG, "location : " + location.toString());
}
} catch (Exception e) {
e.printStackTrace();
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Logger.d(TAG, "RTK LocationManager requestLocationUpdates has Exception : " + e.getMessage());
}
Logger.d(TAG, "RTK LocationManager requestLocationUpdates has Exception : " + e.getMessage());
}
} else {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Logger.d(TAG, "RTK LocationManager Provider GPS_PROVIDER unable");
}
Logger.d(TAG, "RTK LocationManager Provider GPS_PROVIDER unable");
}
}
@@ -110,31 +102,23 @@ public class MogoRTKLocation {
locInfo = cloudLocationInfo;
cacheList.add(cloudLocationInfo);
} else {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Logger.e(TAG, "location == null");
}
Logger.e(TAG, "location == null");
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Logger.d(TAG, "onStatusChanged status: " + status);
}
Logger.d(TAG, "onStatusChanged status: " + status);
}
@Override
public void onProviderEnabled(String provider) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Logger.d(TAG, "onProviderEnabled");
}
Logger.d(TAG, "onProviderEnabled");
}
@Override
public void onProviderDisabled(String provider) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Logger.d(TAG, "onProviderEnabled");
}
Logger.d(TAG, "onProviderEnabled");
}
};
@@ -142,15 +126,11 @@ public class MogoRTKLocation {
* 关闭定位服务
*/
public void stop() {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Logger.d(TAG, "stop RTK Location");
}
Logger.d(TAG, "stop RTK Location");
if (locationManager != null && locationListener != null) {
locationManager.removeUpdates(locationListener);
} else {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
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

@@ -2,7 +2,6 @@ package com.mogo.realtime.socket;
import android.content.Context;
import android.os.SystemClock;
import android.util.Log;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener;
@@ -17,6 +16,7 @@ import com.mogo.realtime.entity.MogoSnapshotSetData;
import com.mogo.realtime.entity.OnePerSecondSendContent;
import com.mogo.realtime.spi.RealTimeProviderImp;
import com.mogo.realtime.util.MortonCode;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.zhidao.ptech.connsvr.protocol.MogoConnsvr;
@@ -115,9 +115,7 @@ public class SocketHandler {
if (msgType == MSG_TYPE_DOWNLINK_CAR_DATA.getMsgType()) {
MogoSnapshotSetData data = GsonUtil.objectFromJson(webSocketData.getData(), MogoSnapshotSetData.class);
if (data == null) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.e(TAG, "onMsgReceived MogoSnapshotSetData == null ");
}
Logger.e(TAG, "onMsgReceived MogoSnapshotSetData == null ");
return;
}
for (IMogoCloudOnMsgListener listener : onMsgListenerList) {
@@ -136,9 +134,7 @@ public class SocketHandler {
*/
public void sendMsg(List<CloudLocationInfo> cloudLocationInfo) {
if (cloudLocationInfo == null) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.e(TAG, "请检查传入数组对象为Null");
}
Logger.e(TAG, "请检查传入数组对象为Null");
return;
}
CloudLocationInfo lastInfo = null;
@@ -170,9 +166,7 @@ public class SocketHandler {
if (content.self == null &&
(content.adas == null || content.adas.isEmpty())) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(TAG, "no information to sent");
}
Logger.d(TAG, "no information to sent");
return;
}
@@ -181,15 +175,13 @@ public class SocketHandler {
webSocketData.setSeq(computeSendMsgTime());
webSocketData.setSn(MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
webSocketData.setData(GsonUtil.jsonFromObject(content));
String msg = GsonUtil.jsonFromObject(webSocketData);
int msgType = LOW_FREQUENCY_CHANNEL_ID;
if (cloudLocationInfo.size() > 2) {
msgType = HIGH_FREQUENCY_CHANNEL_ID;
}
MsgBody msgBody = new MsgBody();
msgBody.msgType(msgType);
msgBody.content(msg);
msgBody.content(webSocketData);
SocketManager.getInstance().sendMsg(mAppId, HEADER_TYPE, msgBody, msgId -> {
for (IMogoCloudOnMsgListener listener : onMsgListenerList) {
if (listener != null) {

View File

@@ -22,8 +22,6 @@ import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import static android.content.ContentValues.TAG;
/**
* @author lixiaopeng
* @description 道路搜索
@@ -81,7 +79,7 @@ public class MogoRoadSearchManager {
@Override
public void onNext(@NonNull BaseData<RoadInfos> roadInfos) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onNext roadInfos = " + roadInfos.getResult().getData());
Log.d(HttpConstant.TAG, "queryRoadInfos onNext roadInfos = " + roadInfos.getResult().getData());
}
callback.onSuccess(roadInfos);
}
@@ -94,7 +92,7 @@ public class MogoRoadSearchManager {
@Override
public void onComplete() {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "queryRoadInfos onComplete ");
Log.d(HttpConstant.TAG, "queryRoadInfos onComplete ");
}
}
});

View File

@@ -6,5 +6,5 @@ package com.mogo.cloud.tanlu.constant;
* @since 2021/1/20
*/
public class HttpConstant {
public static final String TANLU = "TANLU_MODULE";
public static final String TAG = "MoGoAiCloud_TanLu";
}

View File

@@ -72,7 +72,7 @@ public class CosUpload implements CosStatusCallback {
videoCoverImage = getVideoPicPath();
boolean isSuccess = getVideoThumbnail(info.getFilePath(), videoCoverImage);
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "isSuccess = " + isSuccess + "--videoCoverImage = " + videoCoverImage);
Log.d(HttpConstant.TAG, "isSuccess = " + isSuccess + "--videoCoverImage = " + videoCoverImage);
}
filePath.add(info.getFilePath());
filePath.add(videoCoverImage);
@@ -81,7 +81,7 @@ public class CosUpload implements CosStatusCallback {
filePath.add(info.getFilePath());
}
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "filePath.size() = " + filePath.size());
Log.d(HttpConstant.TAG, "filePath.size() = " + filePath.size());
}
CosUploadManagerImpl.getInstance(mContext.getApplicationContext())
.upload(filePath, mPicEventId, DbPriorityConfig.PRIORITY_HIGH);
@@ -99,8 +99,8 @@ public class CosUpload implements CosStatusCallback {
@Override
public void uploadCosCompleted(String cosPath, String eventId, String downloadUrl, String localPath) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "uploadCosCompleted ----> cosPath =" + cosPath + "--eventId =" + eventId);
Log.d(HttpConstant.TANLU, "uploadCosCompleted ----> downloadUrl =" + downloadUrl + "--localPath =" + localPath);
Log.d(HttpConstant.TAG, "uploadCosCompleted ----> cosPath =" + cosPath + "--eventId =" + eventId);
Log.d(HttpConstant.TAG, "uploadCosCompleted ----> downloadUrl =" + downloadUrl + "--localPath =" + localPath);
}
if (filePath.size() == 2) {
if (isVideo(localPath)) { //如果是视频 localPath
@@ -109,7 +109,7 @@ public class CosUpload implements CosStatusCallback {
mCosPicUrl = downloadUrl;
}
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "mCosVideoUrl = " + mCosVideoUrl + " >>>mCosPicUrl = " + mCosPicUrl);
Log.d(HttpConstant.TAG, "mCosVideoUrl = " + mCosVideoUrl + " >>>mCosPicUrl = " + mCosPicUrl);
}
if (mCosPicUrl != null && mCosVideoUrl != null) {
sendInformation();
@@ -123,7 +123,7 @@ public class CosUpload implements CosStatusCallback {
@Override
public void uploadCosFailed(String cosPath, String eventId, String localPath) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.e(HttpConstant.TANLU, "uploadCosFailed ----> cosPath = " + cosPath + "--eventId =" + eventId + "--localPath =" + localPath);
Log.e(HttpConstant.TAG, "uploadCosFailed ----> cosPath = " + cosPath + "--eventId =" + eventId + "--localPath =" + localPath);
}
sendInformation();
}
@@ -149,7 +149,7 @@ public class CosUpload implements CosStatusCallback {
public void onSuccess(BaseData<UploadResult> result) {
if (result != null && result.getResult() != null) {
if (MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isShowDebugLog()) {
Log.d(HttpConstant.TANLU, "uploadRoadInfo result.id = " + result.getResult().id);
Log.d(HttpConstant.TAG, "uploadRoadInfo result.id = " + result.getResult().id);
}
}
mCallback.onSuccess(result);

View File

@@ -5,14 +5,14 @@ public class MoGoAiCloudTrafficLive {
/**
* 查看前方车辆直播
*/
public static void getVehicleHeadLiveUrl(ITrafficLiveCallBack callBack) {
public static void viewVehicleHeadLive(ITrafficLiveCallBack callBack) {
}
/**
* 查看前方路口直播
*/
public static void getIntersectionLiveUrl(ITrafficLiveCallBack callBack) {
public static void viewIntersectionLive(ITrafficLiveCallBack callBack) {
}
}

View File

@@ -2,5 +2,5 @@ package com.mogo.cloud.trafficlive.constant;
public class TrafficLiveConstant {
public static final String TAG = "TrafficLiveConstant";
public static final String TAG = "MoGoAiCloud_TrafficLive";
}

View File

@@ -23,4 +23,8 @@ public class TrafficLiveManager {
public void getVehicleHeadLiveUrl(ITrafficLiveCallBack callBack){
}
public void getIntersectionLiveUrl(ITrafficLiveCallBack callBack){
}
}