行车超视距功能修改
描述: 1. 车侧、路侧两个接口分开 2. 兼容两套播放方式 Signed-off-by: chenfufeng <chenfufeng@zhidaoauto.com>
This commit is contained in:
@@ -50,6 +50,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.flexbox
|
||||
implementation rootProject.ext.dependencies.mogoaicloudtrafficlive
|
||||
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import androidx.fragment.app.FragmentActivity
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.eagle.core.data.camera.Camera
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
|
||||
import com.mogo.eagle.core.data.notice.NoticeNormalData
|
||||
@@ -329,7 +329,7 @@ class MoGoHmiFragment : MvpFragment<MoGoWarningContract.View?, WaringPresenter?>
|
||||
floatView?.pushBeanChanged(normalData)
|
||||
}
|
||||
|
||||
private fun showCameraList(cameraList: List<Camera>?) {
|
||||
private fun showCameraList(cameraList: List<CameraEntity>?) {
|
||||
context?.let {
|
||||
if (cameraViewFloat == null) {
|
||||
if (cameraListView == null) {
|
||||
|
||||
@@ -7,16 +7,20 @@ import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import com.mogo.eagle.core.data.camera.Camera
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
class CameraListAdapter: Adapter<CameraListAdapter.CameraListHolder> {
|
||||
class CameraListAdapter : Adapter<CameraListAdapter.CameraListHolder> {
|
||||
|
||||
private var context: Context? = null
|
||||
var data: List<Camera>? = null
|
||||
var data: List<CameraEntity>? = null
|
||||
private var clickListener: View.OnClickListener? = null
|
||||
|
||||
constructor(context: Context, data: List<Camera>?, clickListener: View.OnClickListener? = null) {
|
||||
constructor(
|
||||
context: Context,
|
||||
data: List<CameraEntity>?,
|
||||
clickListener: View.OnClickListener? = null
|
||||
) {
|
||||
this.context = context
|
||||
this.data = data
|
||||
this.clickListener = clickListener
|
||||
@@ -30,16 +34,13 @@ class CameraListAdapter: Adapter<CameraListAdapter.CameraListHolder> {
|
||||
|
||||
override fun onBindViewHolder(holder: CameraListHolder, position: Int) {
|
||||
data?.let {
|
||||
holder.cameraInfo.text = with(it[position]) {
|
||||
"${roadName}${crossingName}"
|
||||
}
|
||||
holder.bottomLine.visibility = if (it.size - 1 == position) View.INVISIBLE else View.VISIBLE
|
||||
if (position == 0) {
|
||||
// 顺义可直接查看摄像头视频的地址,用来测试
|
||||
holder.itemView.tag = "https://video.zhidaohulian.com/live/origin_13_48.flv?txSecret=397b1296eb548c737871fca242ff7ec5&txTime=6AABBEB2"
|
||||
} else {
|
||||
holder.itemView.tag = it[position].flvUrl
|
||||
val cameraEntity = it[position]
|
||||
holder.cameraInfo.text = with(cameraEntity) {
|
||||
if (!isCarLive()) "${roadName}${crossingName}${getHeadingStr()}" else sn
|
||||
}
|
||||
holder.bottomLine.visibility =
|
||||
if (it.size - 1 == position) View.INVISIBLE else View.VISIBLE
|
||||
holder.itemView.tag = cameraEntity
|
||||
holder.itemView.setOnClickListener(clickListener)
|
||||
}
|
||||
}
|
||||
@@ -50,6 +51,6 @@ class CameraListAdapter: Adapter<CameraListAdapter.CameraListHolder> {
|
||||
var cameraInfo: TextView = itemView.findViewById(R.id.tvCameraInfo)
|
||||
var bottomLine: View = itemView.findViewById(R.id.viewBottomLine)
|
||||
|
||||
constructor(itemView: View): super(itemView)
|
||||
constructor(itemView: View) : super(itemView)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.camera
|
||||
|
||||
import android.animation.ValueAnimator
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.text.SpannableStringBuilder
|
||||
@@ -11,7 +12,11 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.eagle.core.data.camera.Camera
|
||||
import com.mogo.cloud.live.manager.LiveStreamManagerImpl
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.cloud.trafficlive.api.ITrafficCarLiveCallBack
|
||||
import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
@@ -28,7 +33,7 @@ class CameraListView : FrameLayout {
|
||||
|
||||
private val TAG = "CameraListView"
|
||||
|
||||
var cameraInfoList = ArrayList<Camera>()
|
||||
var cameraInfoList = ArrayList<CameraEntity>()
|
||||
private var clickListener: ClickListener? = null
|
||||
private val gsyVideoOptionBuilder by lazy {
|
||||
GSYVideoOptionBuilder()
|
||||
@@ -41,10 +46,20 @@ class CameraListView : FrameLayout {
|
||||
SpannableStringBuilder("当前路口信号丢失,3S 后自动关闭")
|
||||
}
|
||||
private var isCloseStatus = true
|
||||
|
||||
// 是否播放成功
|
||||
private var isPlaySuccess = false
|
||||
private val valueAnimator by lazy {
|
||||
ValueAnimator.ofInt(3, 0)
|
||||
}
|
||||
private val liveStreamManager by lazy {
|
||||
LiveStreamManagerImpl.getInstance(
|
||||
context.applicationContext as Application?,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
}
|
||||
private var liveSn: String? = ""
|
||||
private var isCarLive = false
|
||||
|
||||
@JvmOverloads
|
||||
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : super(
|
||||
@@ -62,32 +77,43 @@ class CameraListView : FrameLayout {
|
||||
rvCameraList.layoutManager =
|
||||
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
rvCameraList.adapter = CameraListAdapter(context, cameraInfoList) {
|
||||
it.tag?.let { tag ->
|
||||
it.tag?.let { cameraEntity ->
|
||||
showLiveView()
|
||||
isCloseStatus = false
|
||||
isPlaySuccess = false
|
||||
showLiveView()
|
||||
clickListener?.onShowLive(true)
|
||||
val flvUrl = tag as String
|
||||
gsyVideoOptionBuilder.setUrl(flvUrl)
|
||||
.setCacheWithPlay(false)
|
||||
.setAutoFullWithSize(false)
|
||||
.setPlayTag(TAG).build(svpPlayer)
|
||||
svpPlayer.startButton.performClick()
|
||||
isCarLive = false
|
||||
if (cameraEntity is CameraEntity) {
|
||||
when {
|
||||
!cameraEntity.isCarLive() -> {
|
||||
isCarLive = false
|
||||
if (!cameraEntity.flvUrl.isNullOrEmpty()) gsyVideoPlay(cameraEntity.flvUrl!!)
|
||||
}
|
||||
else -> {
|
||||
isCarLive = true
|
||||
liveSn = cameraEntity.sn
|
||||
MoGoAiCloudTrafficLive.viewDesignativeVehicleLive(
|
||||
liveSn,
|
||||
surfaceView,
|
||||
trafficCarLiveCallBack
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ivCloseIcon.setOnClickListener {
|
||||
isPlaySuccess = false
|
||||
isCarLive = false
|
||||
when {
|
||||
isCloseStatus -> clickListener?.onClose(it)
|
||||
else -> {
|
||||
hideLiveView()
|
||||
isCloseStatus -> clickListener?.onClose(it)// 直接退出
|
||||
else -> {// 返回摄像头列表
|
||||
showCameraList()
|
||||
isCloseStatus = true
|
||||
// 无信号倒计时时点击返回
|
||||
if (ivSignalIcon.visibility == View.VISIBLE) {
|
||||
hideNoSignalView()
|
||||
} else {
|
||||
stopLive()
|
||||
clickListener?.onShowLive(false)
|
||||
}
|
||||
stopLive()
|
||||
if (valueAnimator.isRunning) {
|
||||
valueAnimator.cancel()
|
||||
}
|
||||
@@ -131,12 +157,14 @@ class CameraListView : FrameLayout {
|
||||
valueAnimator.addUpdateListener {
|
||||
when (val currentValue = it.animatedValue as Int) {
|
||||
0 -> {
|
||||
isPlaySuccess = false
|
||||
if (isPlaySuccess) {
|
||||
clickListener?.onClose(ivSignalIcon)
|
||||
} else {
|
||||
hideNoSignalView()
|
||||
showCameraList()
|
||||
clickListener?.onShowLive(false)
|
||||
}
|
||||
isPlaySuccess = false
|
||||
isCarLive = false
|
||||
}
|
||||
else -> {
|
||||
if (isPlaySuccess) {
|
||||
@@ -149,9 +177,46 @@ class CameraListView : FrameLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
liveStreamManager.setLiveStatusChangeCallback {
|
||||
surfaceView.post {
|
||||
handleSnLiveStatus(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateCameraData(cameraInfoList: List<Camera>?) {
|
||||
private fun handleSnLiveStatus(status: Int) {
|
||||
when (status) {
|
||||
0 -> {// 正在直播
|
||||
}
|
||||
1 -> {// 直播已停止
|
||||
}
|
||||
2 -> {// 直播强制结束
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val trafficCarLiveCallBack = object : ITrafficCarLiveCallBack {
|
||||
override fun onLive(liveSn: String?) {
|
||||
// 开始直播
|
||||
progressBar.visibility = View.GONE
|
||||
surfaceView.visibility = View.VISIBLE
|
||||
isPlaySuccess = true
|
||||
}
|
||||
|
||||
override fun onDisConnect() {
|
||||
// 断开连接
|
||||
showNoSignalView()
|
||||
valueAnimator.start()
|
||||
}
|
||||
|
||||
override fun onError(errorMsg: String?) {
|
||||
// 发生错误
|
||||
showNoSignalView()
|
||||
valueAnimator.start()
|
||||
}
|
||||
}
|
||||
|
||||
fun updateCameraData(cameraInfoList: List<CameraEntity>?) {
|
||||
cameraInfoList?.let {
|
||||
this.cameraInfoList.clear()
|
||||
this.cameraInfoList.addAll(it)
|
||||
@@ -162,6 +227,18 @@ class CameraListView : FrameLayout {
|
||||
this.clickListener = clickListener
|
||||
}
|
||||
|
||||
/**
|
||||
* 两者播放直播的方式之一
|
||||
*/
|
||||
private fun gsyVideoPlay(flvUrl: String) {
|
||||
clickListener?.onShowLive(true)
|
||||
gsyVideoOptionBuilder.setUrl(flvUrl)
|
||||
.setCacheWithPlay(false)
|
||||
.setAutoFullWithSize(false)
|
||||
.setPlayTag(TAG).build(svpPlayer)
|
||||
svpPlayer.startButton.performClick()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
}
|
||||
@@ -174,25 +251,42 @@ class CameraListView : FrameLayout {
|
||||
}
|
||||
|
||||
private fun stopLive() {
|
||||
try {
|
||||
GSYVideoManager.releaseAllVideos()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
when {
|
||||
!isCarLive -> {
|
||||
try {
|
||||
GSYVideoManager.releaseAllVideos()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
if (!liveSn.isNullOrEmpty()) MoGoAiCloudTrafficLive.stopCarLive(liveSn)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showLiveView() {
|
||||
if (!isCarLive) {
|
||||
surfaceView.visibility = View.GONE
|
||||
} else {
|
||||
svpPlayer.visibility = View.GONE
|
||||
}
|
||||
progressBar.visibility = View.VISIBLE
|
||||
ivSignalIcon.visibility = View.GONE
|
||||
tvTipContent.visibility = View.GONE
|
||||
tvCameraTitle.visibility = View.GONE
|
||||
rvCameraList.visibility = View.GONE
|
||||
progressBar.visibility = View.VISIBLE
|
||||
ivCloseIcon.setBackgroundResource(R.drawable.icon_back)
|
||||
}
|
||||
|
||||
private fun hideLiveView() {
|
||||
private fun showCameraList() {
|
||||
tvCameraTitle.visibility = View.VISIBLE
|
||||
rvCameraList.visibility = View.VISIBLE
|
||||
svpPlayer.visibility = View.GONE
|
||||
surfaceView.visibility = View.GONE
|
||||
progressBar.visibility = View.GONE
|
||||
ivSignalIcon.visibility = View.GONE
|
||||
tvTipContent.visibility = View.GONE
|
||||
ivCloseIcon.setBackgroundResource(R.drawable.icon_close_nor)
|
||||
}
|
||||
|
||||
@@ -201,17 +295,11 @@ class CameraListView : FrameLayout {
|
||||
tvTipContent.visibility = View.VISIBLE
|
||||
tvCameraTitle.visibility = View.GONE
|
||||
rvCameraList.visibility = View.GONE
|
||||
surfaceView.visibility = View.GONE
|
||||
svpPlayer.visibility = View.GONE
|
||||
progressBar.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun hideNoSignalView() {
|
||||
ivSignalIcon.visibility = View.GONE
|
||||
tvTipContent.visibility = View.GONE
|
||||
hideLiveView()
|
||||
clickListener?.onShowLive(false)
|
||||
}
|
||||
|
||||
interface ClickListener {
|
||||
fun onShowLive(isShow: Boolean)
|
||||
fun onClose(v: View)
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.eagle.core.widget.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:roundLayoutRadius="30px"
|
||||
android:background="@color/notice_check_dialog_bg_color"
|
||||
android:minWidth="777px"
|
||||
android:minHeight="485px"
|
||||
android:background="@color/notice_check_dialog_bg_color">
|
||||
app:roundLayoutRadius="30px">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCameraTitle"
|
||||
@@ -18,7 +19,8 @@
|
||||
android:textSize="42px"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="gone" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvCameraList"
|
||||
@@ -27,65 +29,71 @@
|
||||
android:layout_marginTop="24px"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCameraTitle" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCameraTitle"
|
||||
tools:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSignalIcon"
|
||||
android:layout_width="190px"
|
||||
android:layout_height="142px"
|
||||
android:background="@drawable/icon_signal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="81px"
|
||||
android:background="@drawable/icon_signal"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTipContent"
|
||||
android:layout_width="448px"
|
||||
android:layout_height="100px"
|
||||
android:text="当前设备暂无信号,切换其他摄像头 3S"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ivSignalIcon"
|
||||
android:layout_marginTop="60px"
|
||||
android:gravity="center"
|
||||
android:text="当前设备暂无信号,切换其他摄像头 3S"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="36px"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/ivSignalIcon" />
|
||||
|
||||
<com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
|
||||
android:id="@+id/svpPlayer"
|
||||
android:layout_width="778px"
|
||||
android:layout_height="487px"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!--摄像头数据需要两种播放方式-->
|
||||
<SurfaceView
|
||||
android:id="@+id/surfaceView"
|
||||
android:layout_width="778px"
|
||||
android:layout_height="487px"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.core.widget.ContentLoadingProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
style="?android:attr/progressBarStyleSmall"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivCloseIcon"
|
||||
android:layout_width="86px"
|
||||
android:layout_height="86px"
|
||||
android:background="@drawable/icon_close_nor"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="30px"
|
||||
android:layout_marginTop="17px"
|
||||
/>
|
||||
android:background="@drawable/icon_close_nor"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</com.mogo.eagle.core.widget.RoundConstraintLayout>
|
||||
@@ -4,6 +4,9 @@ import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import com.mogo.eagle.core.data.camera.Camera
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity
|
||||
import com.mogo.eagle.core.data.camera.LiveCameraInfo
|
||||
import com.mogo.eagle.core.data.camera.ReqLiveCarBean
|
||||
import com.mogo.eagle.core.function.monitoring.net.CameraListServices
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.constants.HostConst
|
||||
@@ -19,7 +22,9 @@ class CronTaskManager {
|
||||
MogoApisHandler.getInstance().apis.networkApi
|
||||
}
|
||||
private var disposable: Disposable? = null
|
||||
private var cameraList: List<Camera>? = null
|
||||
private var carDisposable: Disposable? = null
|
||||
private var cameraList: List<CameraEntity>? = null
|
||||
private var carCameraList: List<CameraEntity>? = null
|
||||
|
||||
private val cronHandler: Handler = object : Handler(Looper.getMainLooper()) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
@@ -27,7 +32,9 @@ class CronTaskManager {
|
||||
when (msg.what) {
|
||||
CRON_TASK_TYPE -> {
|
||||
removeMessages(CRON_TASK_TYPE)
|
||||
// 路测和车侧摄像头列表分开调用
|
||||
requestCameraList()
|
||||
requestCarCameraList()
|
||||
sendEmptyMessageDelayed(CRON_TASK_TYPE, 10000)
|
||||
}
|
||||
}
|
||||
@@ -42,7 +49,9 @@ class CronTaskManager {
|
||||
.map { cameraListInfo ->
|
||||
cameraListInfo.result?.crossings?.flatMap { crossing ->
|
||||
crossing.cameras.filter { camera ->
|
||||
!camera.flvUrl.isNullOrEmpty() && !camera.rtmpUrl.isNullOrEmpty()
|
||||
!camera.flvUrl.isNullOrEmpty()
|
||||
}.map {
|
||||
CameraEntity(it.flvUrl, "", it.roadName, it.crossingName, it.getHeadingStr())
|
||||
}
|
||||
} ?: ArrayList()
|
||||
}
|
||||
@@ -54,14 +63,37 @@ class CronTaskManager {
|
||||
})
|
||||
}
|
||||
|
||||
private fun requestCarCameraList() {
|
||||
carDisposable = netWork.create(CameraListServices::class.java, HostConst.LAUNCHER_SNAPSHOT_HOST)
|
||||
.getCarCameraList(ReqLiveCarBean(116.41710185, 39.96944794))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.map { liveCarCameraInfo ->
|
||||
liveCarCameraInfo.result?.liveCamera?.filter { liveCarCamera ->
|
||||
!liveCarCamera.videoSn.isNullOrEmpty()
|
||||
}?.map { cameraInfo ->
|
||||
CameraEntity(sn = cameraInfo.videoSn)
|
||||
} ?: ArrayList()
|
||||
}
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
carCameraList = it
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
})
|
||||
}
|
||||
|
||||
fun startCronTask() {
|
||||
cronHandler.sendEmptyMessageDelayed(CRON_TASK_TYPE, 0)
|
||||
}
|
||||
|
||||
fun getCameraList() = cameraList
|
||||
fun getCameraList() = ArrayList<CameraEntity>().apply {
|
||||
cameraList?.let { addAll(it) }
|
||||
carCameraList?.let { addAll(it) }
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
disposable?.dispose()
|
||||
carDisposable?.dispose()
|
||||
cronHandler.removeMessages(CRON_TASK_TYPE)
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.camera.Camera;
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.monitoring.IMoGoMonitoringProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
@@ -36,7 +36,7 @@ public class MoGoMonitoringProvider implements IMoGoMonitoringProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Camera> getCameraList() {
|
||||
public List<CameraEntity> getCameraList() {
|
||||
return mCronTaskManager.getCameraList();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
package com.mogo.eagle.core.function.monitoring.net
|
||||
|
||||
import com.mogo.eagle.core.data.camera.CameraListInfo
|
||||
import com.mogo.eagle.core.data.camera.LiveCarCameraInfo
|
||||
import com.mogo.eagle.core.data.camera.ReqLiveCarBean
|
||||
import io.reactivex.Single
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Query
|
||||
|
||||
interface CameraListServices {
|
||||
@GET("/yycp-smartTransportationAiCloud-service/eagle/device/list")
|
||||
fun getCameraList(@Query("roadId") roadId: String?): Single<CameraListInfo?>
|
||||
|
||||
@POST("/yycp-launcherSnapshot/launcherSnapshot/queryLiveCarByLocal")
|
||||
fun getCarCameraList(@Body reqBody: ReqLiveCarBean): Single<LiveCarCameraInfo?>
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.eagle.core.data.camera
|
||||
|
||||
data class CameraEntity(
|
||||
var flvUrl: String?="",
|
||||
var sn: String?="",
|
||||
var roadName: String?="",
|
||||
var crossingName: String?="",
|
||||
var headingDesc: String?=""
|
||||
) {
|
||||
fun isCarLive() = !sn.isNullOrEmpty()
|
||||
fun getHeadingStr() = if (headingDesc != null) headingDesc else ""
|
||||
}
|
||||
@@ -83,4 +83,14 @@ data class Camera(
|
||||
var stat: String,
|
||||
@SerializedName("subCategory")
|
||||
var subCategory: Any?
|
||||
): Serializable
|
||||
): Serializable {
|
||||
fun getHeadingStr(): String {
|
||||
var headingStr = ""
|
||||
if (headingDesc != null) {
|
||||
if (headingDesc is String) {
|
||||
headingStr = headingDesc as String
|
||||
}
|
||||
}
|
||||
return headingStr
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.eagle.core.data.camera
|
||||
|
||||
import androidx.annotation.Keep
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
|
||||
@Keep
|
||||
data class LiveCarCameraInfo (
|
||||
@SerializedName("result")
|
||||
var result: LiveResult?
|
||||
): BaseData()
|
||||
|
||||
@Keep
|
||||
data class LiveResult(
|
||||
@SerializedName("LiveCars")
|
||||
var liveCamera: List<LiveCameraInfo>
|
||||
)
|
||||
|
||||
@Keep
|
||||
data class LiveCameraInfo(
|
||||
var videoUrl: String,
|
||||
var videoChannel: String,
|
||||
var videoSn: String
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.mogo.eagle.core.data.camera
|
||||
|
||||
import androidx.annotation.Keep
|
||||
|
||||
@Keep
|
||||
data class ReqLiveCarBean(var lon: Double, var lat: Double, var distance: Int = 200)
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.eagle.core.function.api.monitoring;
|
||||
|
||||
import com.mogo.eagle.core.data.camera.Camera;
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity;
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
|
||||
|
||||
import java.util.List;
|
||||
@@ -11,5 +11,5 @@ import java.util.List;
|
||||
* 超视距功能,路测摄像头,前车摄像头监控
|
||||
*/
|
||||
public interface IMoGoMonitoringProvider extends IMoGoFunctionServerProvider {
|
||||
List<Camera> getCameraList();
|
||||
List<CameraEntity> getCameraList();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.eagle.core.function.call.monitor
|
||||
|
||||
import com.mogo.eagle.core.data.camera.Camera
|
||||
import com.mogo.eagle.core.data.camera.CameraEntity
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.monitoring.IMoGoMonitoringProvider
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
@@ -11,7 +11,7 @@ object CallerMonitorManager {
|
||||
IMoGoMonitoringProvider::class.java,
|
||||
MogoServicePaths.PATH_AI_MONITORING)
|
||||
|
||||
fun getCameraList(): List<Camera>? {
|
||||
fun getCameraList(): List<CameraEntity>? {
|
||||
return providerApi.cameraList
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user