Merge branch 'dev2_aiSdk' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into dev2_aiSdk

This commit is contained in:
wangcongtao
2021-02-23 16:25:49 +08:00
25 changed files with 84 additions and 563 deletions

View File

@@ -66,7 +66,7 @@ dependencies {
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.uploadroadinfo
implementation rootProject.ext.dependencies.mogoaicloudtanlu
if (Boolean.valueOf(RELEASE)) {

View File

@@ -5,6 +5,8 @@ import android.util.ArrayMap;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.share.IMogoTanluProvider;
import com.mogo.service.share.TanluUploadParams;
import com.mogo.utils.logger.Logger;
@@ -38,9 +40,10 @@ public class MogoTanluApiProvider implements IMogoTanluProvider {
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));
params.getLocation().lat, params.getLocation().lon, location.getAddress(), location.getBearing(), location.getAdCode(), location.getCityCode()));
}else{
Logger.e(API_MODULE_NAME,"params为空无法上报情报");
}

View File

@@ -44,6 +44,12 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
private var mLatitude: Double = 0.0
private var mSpeed: Float = 0f
private var mAddress: String = ""
private var mDirection: Float = 0f
private var mAreaCode: String = ""
private var mCityCode: String = ""
private var getVideoFailed: (() -> Unit)? = null
private var interceptors: ArrayList<TakePhotoInterceptor> = ArrayList(1)
@@ -71,6 +77,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
zdCarCoderController.init()
}
fun takePhoto(
photoType: Int,
cameraId: Int,
@@ -81,7 +88,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
fromType: String,
longitude: Double,
latitude: Double,
speed: Float
speed: Float,
address: String,
direction: Float,
areaCode: String,
cityCode: String
) {
Log.d(TAG, "takePhoto ---------- type = $type --- mType = $mType ---fromType = $fromType")
this.mType = type
@@ -90,6 +101,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
this.mLongitude = longitude
this.mLatitude = latitude
this.mSpeed = speed
this.mAddress = address
this.mDirection = direction
this.mAreaCode = areaCode
this.mCityCode = cityCode
CustomStatusHandler.offerPhotoStatus(isCustom)
zdCarCoderController.takePhoto(photoType, cameraId, haveVoice)
trackGetPhoto(1)
@@ -109,7 +125,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
fromType: String,
longitude: Double,
latitude: Double,
speed: Float
speed: Float,
address: String,
direction: Float,
areaCode: String,
cityCode: String
) {
Log.d(TAG, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType ---type = $type ---speed = $speed")
this.mType = type
@@ -118,6 +138,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
this.mLongitude = longitude
this.mLatitude = latitude
this.mSpeed = speed
this.mAddress = address
this.mDirection = direction
this.mAreaCode = areaCode
this.mCityCode = cityCode
if (DebugConfig.getCarMachineType() == 0) { //自研车机
outputVideoPath = getCompressVideoPath()
CustomStatusHandler.offerVideoStatus(TakeEntity(isCustom, id, fromType))
@@ -130,8 +155,8 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
// } else {
//失败了,传空地址,发起请求
val entity = TakeEntity(isCustom, id, fromType)
videoAndThumbMap["video"] = ""
videoAndThumbMap["thumb"] = ""
// videoAndThumbMap["video"] = ""
// videoAndThumbMap["thumb"] = ""
// CosStatusController().sendInformationDirectly(
// INFO_TYPE_VIDEO,

View File

@@ -76,6 +76,12 @@ class MainService : Service() {
private var mLatitude: Double = 0.0
private lateinit var serviceApis: IMogoServiceApis
private var mAddress: String = ""
private var mDirection: Float = 0f
private var mAreaCode: String = ""
private var mCityCode: String = ""
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
//清理多媒体资源和sp策略数据
clearStrategyType(this)
@@ -95,6 +101,11 @@ class MainService : Service() {
mainInfoId = it.parentId
mLongitude = it.lon
mLatitude = it.lat
mAddress = it.addr
mDirection = it.direction
mAreaCode = it.areaCode
mCityCode = it.cityCode
Log.d(TAG, "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
@@ -274,7 +285,7 @@ class MainService : Service() {
Observable.intervalRange(0, 1, 0, 2_000, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude, speed)
CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode)
}
// }
@@ -292,7 +303,7 @@ class MainService : Service() {
) {
Log.d("MainService", "takeVideo --------1----> fromType = $fromType --isCustom = $isCustom")
// if (isAuthorization(BaseApplication.getAppContext())) {
CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed)
CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode)
// }
postVideoAlarmTask(isInterval)

View File

@@ -3,14 +3,18 @@ package com.zhidao.roadcondition.service
import android.os.Parcel
import android.os.Parcelable
class UploadParams(val eventType: String, val fromType: String, val duration: Int, val parentId: Long, val lat: Double, val lon: Double) : Parcelable {
class UploadParams(val eventType: String, val fromType: String, val duration: Int, val parentId: Long, val lat: Double, val lon: Double,val addr:String,val direction:Float,val areaCode:String,val cityCode:String) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.readString()!!,
parcel.readString()!!,
parcel.readInt(),
parcel.readLong(),
parcel.readDouble(),
parcel.readDouble()
parcel.readDouble(),
parcel.readString()!!,
parcel.readFloat(),
parcel.readString()!!,
parcel.readString()!!
)
override fun writeToParcel(parcel: Parcel, flags: Int) {
@@ -20,6 +24,10 @@ class UploadParams(val eventType: String, val fromType: String, val duration: In
parcel.writeLong(parentId)
parcel.writeDouble(lat)
parcel.writeDouble(lon)
parcel.writeString(addr)
parcel.writeFloat(direction)
parcel.writeString(areaCode)
parcel.writeString(cityCode)
}
@@ -28,7 +36,7 @@ class UploadParams(val eventType: String, val fromType: String, val duration: In
}
override fun toString(): String {
return "UploadParams(eventType='$eventType', fromType='$fromType', duration=$duration, parentId='$parentId', lat=$lat, lon=$lon)"
return "UploadParams(eventType='$eventType', fromType='$fromType', duration=$duration, parentId=$parentId, lat=$lat, lon=$lon, addr='$addr', direction=$direction, areaCode='$areaCode', cityCode='$cityCode')"
}