add click surrounding
This commit is contained in:
@@ -22,5 +22,6 @@ data class InformationBody(
|
||||
val direction: Float,
|
||||
val poiType: String, //类型分类
|
||||
val mainInfoId: Long, //事件id
|
||||
val speed: Float //车速
|
||||
val speed: Float, //车速
|
||||
val fromType: String //上报触发来源
|
||||
)
|
||||
@@ -105,7 +105,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
latitude: Double,
|
||||
speed: Float
|
||||
) {
|
||||
Log.d(TAG, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType ---type = $type ---speed = $speed" )
|
||||
Log.d(TAG, "takeVideo -------- isCustom = $isCustom ---mFromType = $mFromType ---type = $type ---speed = $speed")
|
||||
this.mType = type
|
||||
this.mainInfoId = mainInfoId
|
||||
this.mFromType = fromType
|
||||
@@ -114,7 +114,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
this.mSpeed = speed
|
||||
if (DebugConfig.getCarMachineType() == 0) { //自研车机
|
||||
outputVideoPath = getCompressVideoPath()
|
||||
CustomStatusHandler.offerVideoStatus(TakeEntity(isCustom, id,fromType))
|
||||
CustomStatusHandler.offerVideoStatus(TakeEntity(isCustom, id, fromType))
|
||||
zdCarCoderController.takeVideo(cameraId, duration)
|
||||
trackGetVideo(1)
|
||||
} else { //比亚迪
|
||||
@@ -123,7 +123,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
// TipToast.shortTip("分享失败,请检查网络")
|
||||
// } else {
|
||||
//失败了,传空地址,发起请求
|
||||
val entity = TakeEntity(isCustom, id,fromType)
|
||||
val entity = TakeEntity(isCustom, id, fromType)
|
||||
videoAndThumbMap["video"] = ""
|
||||
videoAndThumbMap["thumb"] = ""
|
||||
|
||||
@@ -165,42 +165,20 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
val isCustom = CustomStatusHandler.pollPhotoStatus()
|
||||
val entity = TakeEntity(isCustom, 0L)
|
||||
Log.e(TAG, "onTakePhotoFail -----mType = $mType --- isCustom = $isCustom")
|
||||
//语音播报 1:上报路况,2:交通检查,3:封路 默认 mType 应该为null
|
||||
// if (mType.equals(TANLU_ROAD_CONGESTION) || mType.equals(TANLU_TRAFFIC_CHECK) || mType.equals(
|
||||
// TANLU_ROAD_CLOSURE
|
||||
// )
|
||||
// || mType.equals(TANLU_ROAD_CURRENT) || mType.equals(TANLU_ROAD_PONDING) || mType.equals(
|
||||
// TANLU_ROAD_ICING
|
||||
// )
|
||||
// || mType.equals(TANLU_ROAD_HEAVY_FOG) || mType.equals(TANLU_ROAD_ACCIDENT) || mType.equals(
|
||||
// TANLU_ROAD_WORK
|
||||
// )
|
||||
// ) {
|
||||
// taskAsync(1_500) {
|
||||
// try {
|
||||
// VoiceController.speakVoice("上报失败")
|
||||
// if (isCustom) {
|
||||
// sendGetInfoFailedReceiver(mType)
|
||||
// }
|
||||
// } catch (e: java.lang.Exception) {
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// }
|
||||
//获取图片失败也上报,图片不打点
|
||||
if (isCustom) {
|
||||
CosStatusController().sendInformationDirectly(
|
||||
INFO_TYPE_IMG,
|
||||
mutableMapOf("pic" to ""),
|
||||
mType,
|
||||
entity,
|
||||
mainInfoId,
|
||||
mLongitude,
|
||||
mLatitude,
|
||||
mSpeed
|
||||
)
|
||||
}
|
||||
|
||||
//获取图片失败也上报,图片不打点
|
||||
if (isCustom) {
|
||||
CosStatusController().sendInformationDirectly(
|
||||
INFO_TYPE_IMG,
|
||||
mutableMapOf("pic" to ""),
|
||||
mType,
|
||||
entity,
|
||||
mainInfoId,
|
||||
mLongitude,
|
||||
mLatitude,
|
||||
mSpeed
|
||||
)
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
//拍照成功回调返回图片本地路径
|
||||
@@ -314,7 +292,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
entity?.let {
|
||||
if (it.isCustom) {
|
||||
compressVideo(videoPath, thumbnailPath, it)
|
||||
}else if (entity.fromType in STRATEGY_UPLOAD_TYPE_ARRAY) {
|
||||
} else if (entity.fromType in STRATEGY_UPLOAD_TYPE_ARRAY) {
|
||||
// 属于策略上报
|
||||
compressVideo(videoPath, thumbnailPath, it)
|
||||
} else {
|
||||
@@ -433,6 +411,22 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
|
||||
override fun onTakeVideoCancel(camera: Int) {
|
||||
Log.d(TAG, "onTakeVideoCancel -----camera = $camera")
|
||||
val entity = CustomStatusHandler.pollVideoStatus()
|
||||
//失败了,传空地址,发起请求
|
||||
videoAndThumbMap["video"] = ""
|
||||
videoAndThumbMap["thumb"] = ""
|
||||
|
||||
CosStatusController().sendInformationDirectly(
|
||||
INFO_TYPE_VIDEO,
|
||||
videoAndThumbMap,
|
||||
mType,
|
||||
entity,
|
||||
mainInfoId,
|
||||
mLongitude,
|
||||
mLatitude,
|
||||
mSpeed
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
//获取图片
|
||||
|
||||
@@ -85,23 +85,6 @@ class CosStatusController : CosStatusCallback {
|
||||
Log.d(TAG, "uploadCosFailed = $localPath")
|
||||
trackUploadCos(2)
|
||||
//语音播报 1:上报路况,2:交通检查,3:封路 默认 mType 应该为null
|
||||
if (CarCorderController.mType.equals(TANLU_ROAD_CONGESTION) || CarCorderController.mType.equals(
|
||||
TANLU_TRAFFIC_CHECK
|
||||
) || CarCorderController.mType.equals(TANLU_ROAD_CLOSURE)
|
||||
|| CarCorderController.mType.equals(TANLU_ROAD_CURRENT) || CarCorderController.mType.equals(
|
||||
TANLU_ROAD_PONDING
|
||||
) || CarCorderController.mType.equals(TANLU_ROAD_ICING)
|
||||
|| CarCorderController.mType.equals(TANLU_ROAD_HEAVY_FOG) || CarCorderController.mType.equals(
|
||||
TANLU_ROAD_ACCIDENT
|
||||
) || CarCorderController.mType.equals(TANLU_ROAD_WORK)
|
||||
) {
|
||||
// VoiceController.speakVoice("cos上报失败")
|
||||
Log.d(TAG, "uploadCosFailed mType = $mType")
|
||||
// if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
|
||||
// sendGetInfoFailedReceiver("100")
|
||||
// }
|
||||
}
|
||||
|
||||
if (!isRetry) {
|
||||
isRetry = true
|
||||
// taskAsync(30_000) { //去掉重试
|
||||
@@ -153,7 +136,7 @@ class CosStatusController : CosStatusCallback {
|
||||
trackUploadCos(5)
|
||||
}
|
||||
} else {
|
||||
//上传图片成功, 如果是上报路况,直接上传,TODO
|
||||
//上传图片成功, 如果是上报路况,直接上传
|
||||
Log.d(TAG, "uploadCosCompleted 分享成功 ---- mType = $mType")
|
||||
sendInformationDirectly(
|
||||
INFO_TYPE_IMG,
|
||||
@@ -213,7 +196,7 @@ class CosStatusController : CosStatusCallback {
|
||||
// CosCallbackMapController.mainService?.let {
|
||||
// CosCallbackMapController.mainService?.sendCustomResult(success)
|
||||
// }
|
||||
Log.d(TAG, "type = $type ----success = $success")
|
||||
Log.d(TAG, "type = $type ----success = $success ----fromType = $mFromType ----poiType = $poiType")
|
||||
if (success) {
|
||||
//分享成功,并打点,如果是上报拥堵,需要takeVideo
|
||||
if (type == INFO_TYPE_VIDEO) {
|
||||
|
||||
@@ -128,8 +128,8 @@ class MainServiceController {
|
||||
|
||||
//上传情报数据
|
||||
fun sendInformationMessage(
|
||||
type: Int,
|
||||
fromType: String,
|
||||
type: Int,
|
||||
url: Map<String, String>,
|
||||
isCustom: Boolean = false,
|
||||
trafficInfoType:String = "",
|
||||
@@ -145,7 +145,6 @@ class MainServiceController {
|
||||
mFromType = fromType
|
||||
mPoiType = poiType
|
||||
|
||||
//删除测试数据
|
||||
var locationInfo = LocationUtil.getInstance().getLocationInfo()
|
||||
if (locationInfo.address.isNullOrEmpty()) {
|
||||
Log.d(TAG, " sendInformationMessage locationInfo.address = $locationInfo.address")
|
||||
@@ -153,7 +152,7 @@ class MainServiceController {
|
||||
geoLocation(type, url, locationInfo, isCustom,trafficInfoType, isShare, customSend,poiType,mainInfoId,speed, longitude,latitude)
|
||||
} else {
|
||||
postInformationMessage(
|
||||
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare,poiType,mainInfoId,longitude,latitude, speed),
|
||||
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare,poiType,mainInfoId,longitude,latitude, speed, mFromType),
|
||||
customSend
|
||||
)
|
||||
}
|
||||
@@ -179,7 +178,7 @@ class MainServiceController {
|
||||
.geoCodeLocation(locationInfo.toLatLngPoint(), {
|
||||
Log.d(TAG, "geoLocation -------start -->")
|
||||
postInformationMessage(
|
||||
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude, speed),
|
||||
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude, speed, mFromType),
|
||||
customSend
|
||||
)
|
||||
}, {
|
||||
@@ -192,10 +191,9 @@ class MainServiceController {
|
||||
//如果两次都失败,直接上报服务端
|
||||
Log.d(TAG, "geoLocation ---- postInformationMessage ---false-->")
|
||||
postInformationMessage(
|
||||
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude,speed),
|
||||
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude,speed, mFromType),
|
||||
customSend
|
||||
)
|
||||
|
||||
false
|
||||
}
|
||||
})
|
||||
@@ -214,31 +212,26 @@ class MainServiceController {
|
||||
onSuccess {
|
||||
if (it.result != null) {
|
||||
Log.i(TAG, "upload success id = " + it.result.id)
|
||||
Log.i(TAG, "upload success mFromType = $mFromType")
|
||||
if (mFromType == "6") {
|
||||
sendUgcStatusReceiver(it.result.id, mPoiType, mFromType)
|
||||
}
|
||||
}
|
||||
|
||||
trackUploadServer(1)
|
||||
// CosStatusController().videoAndThumbMap.clear()
|
||||
customSend?.invoke(true)
|
||||
}
|
||||
onError {
|
||||
Log.i(TAG, "$it upload message ${it.message}")
|
||||
trackUploadServer(2)
|
||||
Log.i(TAG, "upload onError mFromType = $mFromType")
|
||||
if (mFromType == "6") {
|
||||
sendUgcStatusReceiver(0, mPoiType, mFromType)
|
||||
}
|
||||
// CosStatusController().videoAndThumbMap.clear()
|
||||
customSend?.invoke(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun sendUgcStatusReceiver(id: Long, type: String?, fromType: String?) {
|
||||
Log.d(TAG, "sendUgcStatusReceiver ----> id = $id ---type = $type --fromType = $fromType ")
|
||||
Log.d(TAG, "sendUgcStatusReceiver id = $id ---type = $type --fromType = $fromType ")
|
||||
var intent = Intent()
|
||||
intent.action = "com.v2x.ugc.upload.status"
|
||||
intent.putExtra("id", id)
|
||||
|
||||
@@ -33,7 +33,8 @@ fun getInformationBody(
|
||||
mainInfoId: Long,
|
||||
longitude: Double,
|
||||
latitude: Double,
|
||||
speed: Float
|
||||
speed: Float,
|
||||
fromType: String
|
||||
): InformationBody {
|
||||
var jsonArray = JsonArray()
|
||||
var type: Int
|
||||
@@ -72,7 +73,8 @@ fun getInformationBody(
|
||||
locationInfo.direction,
|
||||
poiType,
|
||||
mainInfoId,
|
||||
speed
|
||||
speed,
|
||||
fromType
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user