Commit 59027733 authored by 马乐's avatar 马乐

完事关闭副屏

parent bde90caf
...@@ -299,6 +299,7 @@ class MainActivity : AppCompatActivity() { ...@@ -299,6 +299,7 @@ class MainActivity : AppCompatActivity() {
} }
} catch (e: CancellationException) { } catch (e: CancellationException) {
LogUtils.e("${e.message}") LogUtils.e("${e.message}")
closeAuxiliaryPresentation()
avmLeftCamera.stopPictureSequence(PictureSequenceSource.GENERAL_CAMERA) avmLeftCamera.stopPictureSequence(PictureSequenceSource.GENERAL_CAMERA)
avmFrontCamera.stopPictureSequence(PictureSequenceSource.GENERAL_CAMERA) avmFrontCamera.stopPictureSequence(PictureSequenceSource.GENERAL_CAMERA)
avmRightCamera.stopPictureSequence(PictureSequenceSource.GENERAL_CAMERA) avmRightCamera.stopPictureSequence(PictureSequenceSource.GENERAL_CAMERA)
...@@ -309,8 +310,15 @@ class MainActivity : AppCompatActivity() { ...@@ -309,8 +310,15 @@ class MainActivity : AppCompatActivity() {
} }
} }
binding.stopAvm.setOnClickListener { binding.stopAvm.setOnClickListener {
if (avmPlayJob?.isActive == true) {
avmPlayJob?.cancel(CancellationException("结束AVM实时渲染")) avmPlayJob?.cancel(CancellationException("结束AVM实时渲染"))
} else {
closeAuxiliaryPresentation() closeAuxiliaryPresentation()
avmLeftCamera.stopPictureSequence(PictureSequenceSource.GENERAL_CAMERA)
avmFrontCamera.stopPictureSequence(PictureSequenceSource.GENERAL_CAMERA)
avmRightCamera.stopPictureSequence(PictureSequenceSource.GENERAL_CAMERA)
avmBackCamera.stopPictureSequence(PictureSequenceSource.GENERAL_CAMERA)
}
} }
} }
......
...@@ -111,7 +111,7 @@ fun ArcVisDriveAVMEngine.initializeAvmParams(calibResultPath:File,lookupPath:Fil ...@@ -111,7 +111,7 @@ fun ArcVisDriveAVMEngine.initializeAvmParams(calibResultPath:File,lookupPath:Fil
carInfo.blinkAreaBack = 0 carInfo.blinkAreaBack = 0
carInfo.blinkAreaLeft = 0 carInfo.blinkAreaLeft = 0
calibInfo.avmCarInfo = carInfo calibInfo.avmCarInfo = carInfo
calibInfo.viewPortType = ArcAVMViewPortType.SMALL.value calibInfo.viewPortType = ArcAVMViewPortType.LARGE.value
avmInitInfo.avmCalibInfo = calibInfo avmInitInfo.avmCalibInfo = calibInfo
if (spUtils.getBoolean(CALIB_RESULT)) { if (spUtils.getBoolean(CALIB_RESULT)) {
val avmCalibResult = ArcAVMCalibResult() val avmCalibResult = ArcAVMCalibResult()
...@@ -154,10 +154,11 @@ fun ArcVisDriveAVMEngine.autoCalib(calibResultPath:File,lookupPath:File):Int{ ...@@ -154,10 +154,11 @@ fun ArcVisDriveAVMEngine.autoCalib(calibResultPath:File,lookupPath:File):Int{
} else { } else {
spUtils.put(CALIB_RESULT,false) spUtils.put(CALIB_RESULT,false)
spUtils.put(LOOKUP_TABLE,false) spUtils.put(LOOKUP_TABLE,false)
LogUtils.e("autoCalibrate failed, chessPoints1:${chessInfoList[0].leftChessPoints[0].x}_${chessInfoList[0].leftChessPoints[0].y}," + LogUtils.e("autoCalibrate failed\n" +
"chessPoints2:${chessInfoList[1].leftChessPoints[1].x}_${chessInfoList[1].leftChessPoints[1].y}," + "chessPoints1:${chessInfoList[0].leftChessPoints[0].x}_${chessInfoList[0].leftChessPoints[0].y}\n" +
"chessPoints3:${chessInfoList[2].leftChessPoints[2].x}_${chessInfoList[2].leftChessPoints[2].y}," + "chessPoints2:${chessInfoList[1].leftChessPoints[1].x}_${chessInfoList[1].leftChessPoints[1].y}\n" +
"chessPoints4:${chessInfoList[3].leftChessPoints[3].x}_${chessInfoList[3].leftChessPoints[3].y},") "chessPoints3:${chessInfoList[2].leftChessPoints[2].x}_${chessInfoList[2].leftChessPoints[2].y}\n" +
"chessPoints4:${chessInfoList[3].leftChessPoints[3].x}_${chessInfoList[3].leftChessPoints[3].y}\n")
} }
val getCalibInfo = ArcAVMCalibInfo() val getCalibInfo = ArcAVMCalibInfo()
val getCalibResult = ArcAVMCalibResult() val getCalibResult = ArcAVMCalibResult()
......
...@@ -41,7 +41,6 @@ private val serviceConnection: ServiceConnection = object : ServiceConnection { ...@@ -41,7 +41,6 @@ private val serviceConnection: ServiceConnection = object : ServiceConnection {
override fun onServiceDisconnected(name: ComponentName?) { override fun onServiceDisconnected(name: ComponentName?) {
LogUtils.d("停止副屏服务...") LogUtils.d("停止副屏服务...")
multiScreenService?.dismissSecondPresentation()
//恢复置空 //恢复置空
multiScreenService = null multiScreenService = null
} }
...@@ -54,7 +53,12 @@ fun Context.openAuxiliaryPresentation(){ ...@@ -54,7 +53,12 @@ fun Context.openAuxiliaryPresentation(){
fun Context.closeAuxiliaryPresentation(){ fun Context.closeAuxiliaryPresentation(){
LogUtils.i("解绑副屏服务") LogUtils.i("解绑副屏服务")
try {
multiScreenService?.dismissSecondPresentation()
unbindService(serviceConnection) unbindService(serviceConnection)
} catch (e: IllegalArgumentException) {
LogUtils.e("重复解绑副屏服务.${e.message}")
}
} }
fun feedData(data: ByteArray){ fun feedData(data: ByteArray){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment