opt tanlu
This commit is contained in:
@@ -229,7 +229,6 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-service')
|
||||
implementation project(':modules:mogo-module-v2x')
|
||||
implementation project(':modules:mogo-module-share')
|
||||
// implementation project(':modules:tanlulib')
|
||||
implementation project(':modules:mogo-module-monitor')
|
||||
implementation project(':modules:mogo-module-extensions')
|
||||
implementation project(':modules:mogo-module-map')
|
||||
|
||||
@@ -1,11 +1,39 @@
|
||||
// 网约车服务:仅小巴车、出租车渠道用
|
||||
project.dependencies {
|
||||
f8xxImplementation rootProject.ext.dependencies.mogoochnoop
|
||||
f80xImplementation rootProject.ext.dependencies.mogoochnoop
|
||||
f8AmapImplementation rootProject.ext.dependencies.mogoochnoop
|
||||
|
||||
fochtaxiImplementation rootProject.ext.dependencies.mogoochtaxi
|
||||
fochbusImplementation rootProject.ext.dependencies.mogoochbus
|
||||
f8xxImplementation (rootProject.ext.dependencies.mogoochnoop){
|
||||
exclude group: 'com.mogo.commons' //by group
|
||||
exclude group: 'com.mogo.map' //by group
|
||||
exclude group: 'com.mogo.eagle.core' //by group
|
||||
exclude group: 'com.mogo.eagle.core.function' //by group
|
||||
}
|
||||
f80xImplementation (rootProject.ext.dependencies.mogoochnoop){
|
||||
exclude group: 'com.mogo.commons' //by group
|
||||
exclude group: 'com.mogo.module' //by group
|
||||
exclude group: 'com.mogo.map' //by group
|
||||
exclude group: 'com.mogo.eagle.core' //by group
|
||||
exclude group: 'com.mogo.eagle.core.function' //by group
|
||||
}
|
||||
f8AmapImplementation (rootProject.ext.dependencies.mogoochnoop){
|
||||
exclude group: 'com.mogo.commons' //by group
|
||||
exclude group: 'com.mogo.module' //by group
|
||||
exclude group: 'com.mogo.map' //by group
|
||||
exclude group: 'com.mogo.eagle.core' //by group
|
||||
exclude group: 'com.mogo.eagle.core.function' //by group
|
||||
}
|
||||
fochtaxiImplementation (rootProject.ext.dependencies.mogoochtaxi){
|
||||
exclude group: 'com.mogo.commons' //by group
|
||||
exclude group: 'com.mogo.module' //by group
|
||||
exclude group: 'com.mogo.map' //by group
|
||||
exclude group: 'com.mogo.eagle.core' //by group
|
||||
exclude group: 'com.mogo.eagle.core.function' //by group
|
||||
}
|
||||
fochbusImplementation (rootProject.ext.dependencies.mogoochbus){
|
||||
exclude group: 'com.mogo.commons' //by group
|
||||
exclude group: 'com.mogo.module' //by group
|
||||
exclude group: 'com.mogo.map' //by group
|
||||
exclude group: 'com.mogo.eagle.core' //by group
|
||||
exclude group: 'com.mogo.eagle.core.function' //by group
|
||||
}
|
||||
|
||||
fPadLenovoImplementation (rootProject.ext.dependencies.mogoochnoop){
|
||||
exclude group: 'com.mogo.commons' //by group
|
||||
|
||||
@@ -103,7 +103,6 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-service')
|
||||
implementation project(':modules:mogo-module-v2x')
|
||||
implementation project(':modules:mogo-module-share')
|
||||
// implementation project(':modules:tanlulib')
|
||||
implementation project(':modules:mogo-module-monitor')
|
||||
implementation project(':modules:mogo-module-extensions')
|
||||
implementation project(':modules:mogo-module-map')
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
:modules:mogo-module-push-base
|
||||
:modules:mogo-module-push-noop
|
||||
:modules:mogo-module-push
|
||||
:modules:tanlulib
|
||||
:modules:mogo-module-monitor
|
||||
:core:function-impl:mogo-core-function-autopilot
|
||||
:core:function-impl:mogo-core-function-hmi
|
||||
|
||||
@@ -37,6 +37,10 @@ android {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -53,12 +57,13 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.mogoaicloudtanlu
|
||||
|
||||
implementation rootProject.ext.dependencies.analytics
|
||||
implementation rootProject.ext.dependencies.eventbus
|
||||
implementation rootProject.ext.dependencies.coroutinescore
|
||||
implementation rootProject.ext.dependencies.coroutinesandroid
|
||||
implementation rootProject.ext.dependencies.retrofit
|
||||
implementation rootProject.ext.dependencies.retrofitconvertergson
|
||||
// implementation rootProject.ext.dependencies.retrofit
|
||||
// implementation rootProject.ext.dependencies.retrofitconvertergson
|
||||
implementation 'com.zhidaoauto.controller:api:1.0.8'
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
|
||||
@@ -3,5 +3,10 @@
|
||||
<application>
|
||||
<service android:name=".VoiceCmdService" />
|
||||
|
||||
<!--获取图片和视频的服务-->
|
||||
<service
|
||||
android:name=".service.MainService"
|
||||
android:enabled="true" />
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.mogo.module.share;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.analytics.AnalyticsUtils;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.share.service.MainService;
|
||||
import com.mogo.module.share.service.UploadParams;
|
||||
import com.mogo.service.share.IMogoTanluProvider;
|
||||
import com.mogo.service.share.TanluUploadParams;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_TANLU_API;
|
||||
import static com.mogo.module.share.constant.StrategyShareConstKt.S_TAG;
|
||||
|
||||
/**
|
||||
* 探路api
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = PATH_TANLU_API)
|
||||
public class MogoTanluApiProvider implements IMogoTanluProvider {
|
||||
private Context context;
|
||||
|
||||
/**
|
||||
* 上传情报
|
||||
*
|
||||
* @param params 情报类型
|
||||
*/
|
||||
@Override
|
||||
public void uploadRoadCondition(TanluUploadParams params) {
|
||||
if (params != null) {
|
||||
Logger.d(S_TAG, "uploadRoadCondition: " + params);
|
||||
Map<String, Object> properties = new ArrayMap<>();
|
||||
properties.put("type", params.getEventType());
|
||||
properties.put("from", params.getFromType());
|
||||
AnalyticsUtils.track("v2x_share_type", properties);
|
||||
MogoLocation location = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(context).getLastKnowLocation();
|
||||
MainService.Companion.launchService(context, new UploadParams(params.getEventType(),
|
||||
params.getFromType(), params.getDuration(), params.getParentId(),
|
||||
params.getLocation().lat, params.getLocation().lon, location.getAddress(), location.getBearing(), location.getAdCode(), location.getCityCode()));
|
||||
} else {
|
||||
Logger.e(S_TAG, "params为空,无法上报情报");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启探路业务服务
|
||||
*/
|
||||
@Override
|
||||
public void startTanluService() {
|
||||
Logger.d(S_TAG, "startTanluService");
|
||||
MainService.Companion.launchService(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
this.context = context;
|
||||
Logger.d(S_TAG, "新TanluApi模块 init====");
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ package com.mogo.module.share
|
||||
import android.content.Context
|
||||
import android.util.ArrayMap
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.commons.analytics.AnalyticsUtils
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
@@ -18,7 +19,6 @@ import com.mogo.module.share.service.UploadParams
|
||||
import com.mogo.module.share.strategyreceiver.AccidentStrategyReceiver
|
||||
import com.mogo.module.share.strategyreceiver.BlockStrategy
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.share.IMogoTanluProvider
|
||||
import com.mogo.service.share.TanluUploadParams
|
||||
import com.mogo.utils.logger.Logger
|
||||
import org.json.JSONObject
|
||||
@@ -29,7 +29,7 @@ import org.json.JSONObject
|
||||
* @author lixiaopeng
|
||||
*/
|
||||
@Route(path = MogoServicePaths.PATH_STRATEGY_SHARE)
|
||||
class StrategyShareProvider : IMogoTanluProvider {
|
||||
class StrategyShareProvider : IProvider {
|
||||
private lateinit var blockStrategy: BlockStrategy
|
||||
private var mContext: Context? = null
|
||||
|
||||
@@ -66,33 +66,4 @@ class StrategyShareProvider : IMogoTanluProvider {
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传情报
|
||||
*
|
||||
* @param params 情报类型
|
||||
*/
|
||||
override fun uploadRoadCondition(params: TanluUploadParams?) {
|
||||
if (params != null) {
|
||||
Logger.d(S_TAG, "uploadRoadCondition: $params")
|
||||
val properties: MutableMap<String, Any> = ArrayMap()
|
||||
properties["type"] = params.eventType
|
||||
properties["from"] = params.fromType
|
||||
AnalyticsUtils.track("v2x_share_type", properties)
|
||||
val location = MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(mContext).lastKnowLocation
|
||||
launchService(mContext!!, UploadParams(params.eventType,
|
||||
params.fromType, params.duration, params.parentId,
|
||||
params.location.lat, params.location.lon, location.address, location.bearing, location.adCode, location.cityCode))
|
||||
} else {
|
||||
Logger.e(S_TAG, "params为空,无法上报情报")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启探路业务服务
|
||||
*/
|
||||
override fun startTanluService() {
|
||||
Logger.d(S_TAG, "startTanluService")
|
||||
launchService(mContext!!, null)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,4 +2,5 @@ package com.mogo.module.share.bean
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
|
||||
|
||||
data class BaseDataCompat<T>(var result:T?): BaseData()
|
||||
@@ -29,6 +29,7 @@ public class ShareConstants {
|
||||
public static final String TAG = "/tanlu/ui";
|
||||
public static final String NAVI_INFO = "navi_info";
|
||||
public static final String MODEL_NAME = "CARD_TYPE_ROAD_CONDITION";
|
||||
public static final String TANLU = "TanLu";
|
||||
|
||||
/**
|
||||
* 免唤醒词上报拥堵
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.mogo.module.share.net;
|
||||
|
||||
import com.mogo.module.share.bean.BaseDataCompat;
|
||||
import com.mogo.module.share.bean.RoadInfos;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface ShareLsApiService {
|
||||
/**
|
||||
* 查询(搜索)道路事件信息
|
||||
* 接口文档:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42305842
|
||||
* 文档中有些参数暂时没有用到,包括radius,limit
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
// @FormUrlEncoded
|
||||
// @POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync")
|
||||
// Observable<BaseDataCompat<RoadInfos>> queryRoadInfos(@FieldMap Map<String, Object> params);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.module.share.service
|
||||
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import com.hw.videoprocessor.VideoProcessor
|
||||
import com.mogo.cloud.network.BaseData
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
@@ -14,11 +13,13 @@ import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.module.share.bean.event.GetImageSuccessEvent
|
||||
import com.mogo.module.share.bean.event.LatLngStickyEventBus
|
||||
import com.mogo.module.share.constant.STRATEGY_UPLOAD_TYPE_ARRAY
|
||||
import com.mogo.module.share.constant.ShareConstants.TANLU
|
||||
import com.mogo.module.share.utils.*
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyMaxSpeed
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyMinSpeed
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyType
|
||||
import com.mogo.utils.NetworkUtils
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.auto.carcorder.callback.TakePhotoCallback
|
||||
import com.zhidao.auto.carcorder.callback.TakeVideoCallback
|
||||
import com.zhidao.auto.carcorder.controller.ZdCarCoderController
|
||||
@@ -32,7 +33,6 @@ import kotlin.math.abs
|
||||
* @since 2019-10-30
|
||||
*/
|
||||
object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
const val TAG: String = "CarCorderController"
|
||||
private lateinit var zdCarCoderController: ZdCarCoderController
|
||||
private var outputVideoPath: String = ""
|
||||
private var mType: String = "" //1 上报拥堵, 2 封路和查车
|
||||
@@ -83,7 +83,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
areaCode: String,
|
||||
cityCode: String
|
||||
) {
|
||||
Log.d(TAG, "takePhoto ---------- type = $type --- mType = $mType ---fromType = $fromType")
|
||||
Logger.d(TANLU, "takePhoto ---------- type = $type --- mType = $mType ---fromType = $fromType")
|
||||
this.mType = type
|
||||
this.mainInfoId = mainInfoId
|
||||
this.mFromType = fromType
|
||||
@@ -120,7 +120,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
areaCode: String,
|
||||
cityCode: String
|
||||
) {
|
||||
Log.d(TAG, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType ---type = $type ---speed = $speed")
|
||||
Logger.d(TANLU, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType ---type = $type ---speed = $speed")
|
||||
this.mType = type
|
||||
this.mainInfoId = mainInfoId
|
||||
this.mFromType = fromType
|
||||
@@ -138,7 +138,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
zdCarCoderController.takeVideo(cameraId, duration)
|
||||
trackGetVideo(1)
|
||||
} else { //比亚迪
|
||||
Log.d(TAG, "takeVideo ------ isnet = " + NetworkUtils.isConnected(AbsMogoApplication.getApp().applicationContext))
|
||||
Logger.d(TANLU, "takeVideo ------ isnet = " + NetworkUtils.isConnected(AbsMogoApplication.getApp().applicationContext))
|
||||
getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, CarCorderController.mainInfoId)?.let { uploadRoadInfo(it) }
|
||||
|
||||
//地图上打点
|
||||
@@ -162,7 +162,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
override fun onTakePhotoFail(photoType: Int, camera: Int) {
|
||||
trackGetPhoto(3)
|
||||
val isCustom = CustomStatusHandler.pollPhotoStatus()
|
||||
Log.e(TAG, "onTakePhotoFail -----mType = $mType --- isCustom = $isCustom")
|
||||
Logger.e(TANLU, "onTakePhotoFail -----mType = $mType --- isCustom = $isCustom")
|
||||
//获取图片失败也上报,图片不打点
|
||||
if (isCustom) {
|
||||
getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
|
||||
@@ -174,7 +174,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
//拍照成功回调返回图片本地路径
|
||||
override fun onTakePhotoSuccess(photoType: Int, camera: Int, photoPath: String?) {
|
||||
trackGetPhoto(2)
|
||||
Log.d(TAG, "onTakePhotoSuccess -----mType = $mType --- mainInfoId = $mainInfoId")
|
||||
Logger.d(TANLU, "onTakePhotoSuccess -----mType = $mType --- mainInfoId = $mainInfoId")
|
||||
val isCustom = CustomStatusHandler.pollPhotoStatus()
|
||||
|
||||
if (!isCustom) {
|
||||
@@ -201,20 +201,20 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
val speed = LocationUtil.getInstance().getSpeed()
|
||||
|
||||
if (!TextUtils.isEmpty(mType)) {
|
||||
Log.d(TAG, "onTakePhotoSuccess mType != null")
|
||||
Logger.d(TANLU, "onTakePhotoSuccess mType != null")
|
||||
if (photoPath != null) {
|
||||
getInfo(photoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
|
||||
}
|
||||
|
||||
} else {
|
||||
Log.d(TAG, "onTakePhotoSuccess mType == null")
|
||||
Log.d(
|
||||
TAG,
|
||||
Logger.d(TANLU, "onTakePhotoSuccess mType == null")
|
||||
Logger.d(
|
||||
TANLU,
|
||||
"onTakePhotoSuccess maxSpeedPic = $maxSpeedPic ---> speed = $speed ---->minSpeedPic= $minSpeedPic"
|
||||
)
|
||||
if (maxSpeedPic == -1) {
|
||||
if (speed >= (abs(minSpeedPic) / 3.6f)) {
|
||||
Log.d(TAG, "onTakePhotoSuccess abs =" + (abs(minSpeedPic) / 3.6f))
|
||||
Logger.d(TANLU, "onTakePhotoSuccess abs =" + (abs(minSpeedPic) / 3.6f))
|
||||
if (photoPath != null) {
|
||||
getInfo(photoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
|
||||
}
|
||||
@@ -222,7 +222,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
}
|
||||
|
||||
if (minSpeedPic > 0 && maxSpeedPic > 0) {
|
||||
Log.d(TAG, "onTakePhotoSuccess minSpeedPic > 0 -- speed = $speed")
|
||||
Logger.d(TANLU, "onTakePhotoSuccess minSpeedPic > 0 -- speed = $speed")
|
||||
if ((speed >= (minSpeedPic / 3.6f)) && speed <= (maxSpeedPic / 3.6f)) {
|
||||
if (photoPath != null) {
|
||||
getInfo(photoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
|
||||
@@ -237,8 +237,8 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
val thumbnailPath =
|
||||
AbsMogoApplication.getApp().applicationContext.filesDir.parent + File.separator + "Thumbnail${System.currentTimeMillis()}.jpg"
|
||||
val isSuccess = getVideoThumbnail(videoPath!!, thumbnailPath)
|
||||
Log.d(
|
||||
TAG,
|
||||
Logger.d(
|
||||
TANLU,
|
||||
"getVideo onTakeVideoSuccess===$videoPath -----> isSuccess= $isSuccess ----> mType = $mType --- mainInfoId = $mainInfoId"
|
||||
)
|
||||
|
||||
@@ -270,12 +270,12 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
compressVideo(videoPath, thumbnailPath, it)
|
||||
|
||||
} else {
|
||||
Log.d(
|
||||
TAG,
|
||||
Logger.d(
|
||||
TANLU,
|
||||
"onTakeVideoSuccess maxSpeedVideo = $maxSpeedVideo --->speed= $speed + minSpeedVideo = $minSpeedVideo"
|
||||
)
|
||||
if (maxSpeedVideo == -1) {
|
||||
Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (abs(minSpeedVideo) / 3.6f))
|
||||
Logger.d(TANLU, "onTakeVideoSuccess 111 abs =" + (abs(minSpeedVideo) / 3.6f))
|
||||
if (speed >= (abs(minSpeedVideo) / 3.6f)) {
|
||||
//获取视频以及缩略图成功,开始上报
|
||||
compressVideo(videoPath, thumbnailPath, it)
|
||||
@@ -283,7 +283,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
}
|
||||
|
||||
if (minSpeedVideo > 0 && maxSpeedVideo > 0) {
|
||||
Log.d(TAG, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed")
|
||||
Logger.d(TANLU, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed")
|
||||
if ((speed >= (minSpeedVideo / 3.6f)) && speed <= (maxSpeedVideo / 3.6f)) {
|
||||
compressVideo(videoPath, thumbnailPath, it)
|
||||
} else {
|
||||
@@ -316,8 +316,8 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
* 压缩视频并且上传
|
||||
*/
|
||||
private fun compressVideo(videoPath: String, thumbnailPath: String, entity: TakeEntity) {
|
||||
Log.d(
|
||||
TAG,
|
||||
Logger.d(
|
||||
TANLU,
|
||||
"outputVideoPath = " + outputVideoPath + ">> videoPath=" + videoPath + " isCustom = ${entity.isCustom}"
|
||||
)
|
||||
val startTime = System.currentTimeMillis()
|
||||
@@ -332,12 +332,12 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
.bitrate(2000 * 1024)
|
||||
.frameRate(25)
|
||||
.process()
|
||||
Log.d(TAG, "compress cost time =" + (System.currentTimeMillis() - startTime))
|
||||
Logger.d(TANLU, "compress cost time =" + (System.currentTimeMillis() - startTime))
|
||||
getInfo(outputVideoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
|
||||
//删除压缩前的视频
|
||||
deletePicFile(videoPath)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "compressVideo e = $e")
|
||||
Logger.e(TANLU, "compressVideo e = $e")
|
||||
//删除压缩前的视频
|
||||
deletePicFile(videoPath)
|
||||
e.printStackTrace()
|
||||
@@ -352,14 +352,16 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
MogoUploadManager.getInstance(AbsMogoApplication.getApp().applicationContext).uploadInfo(info, object : ITanluUploadCallback {
|
||||
override fun onSuccess(result: BaseData<UploadResult>) {
|
||||
if (result.result != null) {
|
||||
Log.d(TAG, "result =" + result.result);
|
||||
Logger.d(TANLU, "result =" + result.result)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(code: Int) {
|
||||
Logger.e(TANLU, "onFailure code = $code")
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
Logger.e(TANLU, "onError e = $e")
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -386,11 +388,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
}
|
||||
|
||||
override fun onTakePhotoCancel(photoType: Int, camera: Int) {
|
||||
Log.d(TAG, "onTakePhotoCancel -----photoType = $photoType")
|
||||
Logger.d(TANLU, "onTakePhotoCancel -----photoType = $photoType")
|
||||
}
|
||||
|
||||
override fun onTakeVideoCancel(camera: Int) {
|
||||
Log.d(TAG, "onTakeVideoCancel -----camera = $camera")
|
||||
Logger.d(TANLU, "onTakeVideoCancel -----camera = $camera")
|
||||
//失败了,传空地址,发起请求
|
||||
videoAndThumbMap["video"] = ""
|
||||
videoAndThumbMap["thumb"] = ""
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.elegant.analytics.Analytics
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
@@ -23,6 +22,7 @@ import com.mogo.utils.storage.SharedPrefsMgr
|
||||
import com.zhidao.cosupload.manager.CosUploadManagerImpl
|
||||
import com.mogo.module.share.BuildConfig
|
||||
import com.mogo.module.share.constant.*
|
||||
import com.mogo.module.share.constant.ShareConstants.TANLU
|
||||
import com.mogo.module.share.utils.*
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.clearStrategyType
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyFrequency
|
||||
@@ -43,7 +43,7 @@ class MainService : Service() {
|
||||
companion object {
|
||||
fun launchService(context: Context, params: UploadParams?) {
|
||||
val intent = Intent(context, MainService::class.java).apply {
|
||||
Log.e("MainService", "launch type = $params")
|
||||
Logger.d(TANLU, "launch type = $params")
|
||||
putExtra("params", params)
|
||||
}
|
||||
context.startService(intent)
|
||||
@@ -56,8 +56,6 @@ class MainService : Service() {
|
||||
|
||||
//是否已经获取过策略
|
||||
var isGetStrategies: Boolean = false
|
||||
private val TAG: String = this.javaClass.simpleName
|
||||
|
||||
//1是一次性,2是周期性
|
||||
private var picType: Int = 0
|
||||
private var videoType: Int = 0
|
||||
@@ -90,7 +88,7 @@ class MainService : Service() {
|
||||
if (serviceApis.mapServiceApi.getSingletonLocationClient(this) != null &&
|
||||
serviceApis.mapServiceApi.getSingletonLocationClient(this).lastKnowLocation != null) {
|
||||
speed = serviceApis.mapServiceApi.getSingletonLocationClient(this).lastKnowLocation.speed
|
||||
Log.d(TAG, "onStartCommand speed = $speed")
|
||||
Logger.d(TANLU, "onStartCommand speed = $speed")
|
||||
}
|
||||
|
||||
if (intent != null) {
|
||||
@@ -106,7 +104,7 @@ class MainService : Service() {
|
||||
mAreaCode = it.areaCode
|
||||
mCityCode = it.cityCode
|
||||
|
||||
Log.d(TAG, "onStartCommand shareType = $shareType --fromType = $fromType --mainInfoId = $mainInfoId -- mLongitude = $mLongitude --mLatitude = $mLatitude --it.duration = ${it.duration} ")
|
||||
Logger.d(TANLU, "onStartCommand shareType = $shareType --fromType = $fromType --mainInfoId = $mainInfoId -- mLongitude = $mLongitude --mLatitude = $mLatitude --it.duration = ${it.duration} ")
|
||||
if (fromType == UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO || fromType == UPLOAD_FROM_STRATEGY_BLOCK_AUTO) {
|
||||
// 如果是策略上报,isCustom = false
|
||||
takeVideo(it.duration)
|
||||
@@ -115,7 +113,7 @@ class MainService : Service() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "intent == null ")
|
||||
Logger.e(TANLU, "intent == null ")
|
||||
}
|
||||
|
||||
return super.onStartCommand(intent, flags, startId)
|
||||
@@ -124,7 +122,7 @@ class MainService : Service() {
|
||||
//定时任务回调广播
|
||||
private var mAlarmBroadCast: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(p0: Context?, p1: Intent) {
|
||||
Log.d(TAG, "receive alarm!!!!!!!!!!AlarmType===${p1.getIntExtra("AlarmType", 1)}")
|
||||
Logger.d(TANLU, "receive alarm!!!!!!!!!!AlarmType===${p1.getIntExtra("AlarmType", 1)}")
|
||||
if (p1.action == alarmBroadAction) {
|
||||
if (p1.getIntExtra("AlarmType", 1) == AlarmTypePic) {
|
||||
//拍照
|
||||
@@ -178,9 +176,8 @@ class MainService : Service() {
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true, priority = 98)
|
||||
fun getImageEvent(getImageSuccessEvent: GetImageSuccessEvent) {
|
||||
val info = LocationUtil.getInstance().getLocationInfo()
|
||||
Log.d("MainService", "getImageEvent long = ${info.longitude} ----> lat= ${info.latitude}")
|
||||
Log.d(
|
||||
"MainService",
|
||||
Logger.d(TANLU, "getImageEvent long = ${info.longitude} ----> lat= ${info.latitude}")
|
||||
Logger.d(TANLU,
|
||||
"getImageEvent url = " + getImageSuccessEvent.getImageUrl() + ">>>>type =" + getImageSuccessEvent.getType()
|
||||
)
|
||||
|
||||
@@ -195,7 +192,7 @@ class MainService : Service() {
|
||||
*/
|
||||
private fun initLocationListener() {
|
||||
val isOpen = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().applicationContext).getBoolean("KEY_SERVER_REPORTSTRATEGY_SWITCH", false)
|
||||
Logger.d("EntrancePresenter", " initLocationListener ---- isOpen = $isOpen")
|
||||
Logger.d(TANLU, " initLocationListener ---- isOpen = $isOpen")
|
||||
//开始开始监听速度,只要超过一次5公里每小时则即开始获取策略进行本地上报 只有release才加此判断,qa环境方便测试
|
||||
LocationUtil.getInstance().setonSpeedlistenner(object : LocationUtil.SpeedListener {
|
||||
override fun onSpeedGet(speed: Float) {
|
||||
@@ -204,7 +201,7 @@ class MainService : Service() {
|
||||
mainServiceHttpModel.initStrategies {
|
||||
handleReportStrategy()
|
||||
}
|
||||
Log.d("MainService", "initLocationListener more than 5 start upload speed = $speed")
|
||||
Logger.d(TANLU, "initLocationListener more than 5 start upload speed = $speed")
|
||||
isGetStrategies = true
|
||||
}
|
||||
}
|
||||
@@ -227,7 +224,7 @@ class MainService : Service() {
|
||||
"video",
|
||||
getStrategyType("video")
|
||||
)
|
||||
Log.d("MainService", "handleReportStrategy picType = $picType ---videoType = $videoType")
|
||||
Logger.d(TANLU, "handleReportStrategy picType = $picType ---videoType = $videoType")
|
||||
shareType = TANLU_ROAD_CURRENT
|
||||
if (picType == 1) {
|
||||
takePhoto()
|
||||
@@ -253,7 +250,7 @@ class MainService : Service() {
|
||||
|
||||
//获取图片
|
||||
private fun takePhoto(isInterval: Boolean = false, isCustom: Boolean = false) {
|
||||
Log.d("MainService", "takePhoto -----1----->")
|
||||
Logger.d(TANLU, "takePhoto -----1----->")
|
||||
//判断是否授权
|
||||
// if (isAuthorization(BaseApplication.getAppContext())) {
|
||||
//目前不支持连拍,只能定时2秒拍一张 第一期每次只拍一张
|
||||
@@ -276,7 +273,7 @@ class MainService : Service() {
|
||||
isCustom: Boolean = false,
|
||||
id: Long = 0
|
||||
) {
|
||||
Log.d("MainService", "takeVideo --------1----> fromType = $fromType --isCustom = $isCustom")
|
||||
Logger.d(TANLU, "takeVideo --------1----> fromType = $fromType --isCustom = $isCustom")
|
||||
// if (isAuthorization(BaseApplication.getAppContext())) {
|
||||
CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode)
|
||||
// }
|
||||
@@ -293,8 +290,7 @@ class MainService : Service() {
|
||||
intent.putExtra("number", getLong(PIC_NUMBER, PIC_NUMBER_DEFAULT))
|
||||
intent.putExtra("AlarmType", AlarmTypePic)
|
||||
val pendingIntent = PendingIntent.getBroadcast(this, AlarmTypePic, intent, 0)
|
||||
Log.d(
|
||||
"MainService",
|
||||
Logger.d(TANLU,
|
||||
"postPhotoAlarmTask time =" + getStrategyInterval(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
"pic",
|
||||
@@ -326,8 +322,7 @@ class MainService : Service() {
|
||||
videoIntent.putExtra("AlarmType", AlarmTypeVideo)
|
||||
val videoPendingIntent =
|
||||
PendingIntent.getBroadcast(this, AlarmTypeVideo, videoIntent, 0)
|
||||
Log.d(
|
||||
"MainService",
|
||||
Logger.d(TANLU,
|
||||
"postVideoAlarmTask time =" + getStrategyInterval(
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
"video",
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package com.mogo.module.share.service
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.network.request
|
||||
import com.mogo.module.share.bean.*
|
||||
import com.mogo.module.share.constant.ShareConstants
|
||||
import com.mogo.module.share.constant.ShareConstants.TANLU
|
||||
import com.mogo.module.share.utils.CarNet_Get_Strategy
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyFrequency
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyInterval
|
||||
@@ -12,13 +13,14 @@ import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyM
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyType
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.setStrategyValidity
|
||||
import com.mogo.module.share.utils.trackNormalEvent
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
class MainServiceController {
|
||||
|
||||
companion object {
|
||||
const val TAG = "MainServiceController"
|
||||
// const val TAG = "MainServiceController"
|
||||
}
|
||||
|
||||
//逆地理编码是否重试
|
||||
@@ -36,15 +38,15 @@ class MainServiceController {
|
||||
onSuccess {
|
||||
it.result.let { strategy ->
|
||||
trackNormalEvent(CarNet_Get_Strategy, null)
|
||||
Log.d(TAG, "pic =" + strategy.cityStrategy.pic)
|
||||
Log.d(TAG, "video =" + strategy.cityStrategy.video)
|
||||
Logger.d(TANLU, "pic =" + strategy.cityStrategy.pic)
|
||||
Logger.d(TANLU, "video =" + strategy.cityStrategy.video)
|
||||
syncStrategiesData(strategy.cityStrategy)
|
||||
initFinish?.invoke()
|
||||
}
|
||||
}
|
||||
onError {
|
||||
reInitStrategies()
|
||||
Log.e(TAG, "initStrategies onError ${it.message}")
|
||||
Logger.e(TANLU, "initStrategies onError ${it.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,7 +125,7 @@ class MainServiceController {
|
||||
strategy.video!!.minSpeed
|
||||
)
|
||||
} else {
|
||||
Log.d(TAG, "strategy Data is null")
|
||||
Logger.d(TANLU, "strategy Data is null")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ include ':libraries:map-autonavi'
|
||||
include ':libraries:mogo-map'
|
||||
|
||||
// OLD业务模块
|
||||
//include ':modules:tanlulib'
|
||||
include ':modules:mogo-module-monitor'
|
||||
include ':modules:mogo-module-adas'
|
||||
include ':modules:mogo-module-map'
|
||||
|
||||
Reference in New Issue
Block a user