[m1] 添加M1拼接视频数据订阅接口、清扫车摄像头View和M1摄像头View共用
This commit is contained in:
@@ -100,7 +100,7 @@
|
||||
android:layout_marginTop="@dimen/dp_27"
|
||||
app:roundLayoutRadius="@dimen/dp_16"
|
||||
>
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.SweeperVideoView
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.MogoVideoView
|
||||
android:id="@+id/sweeper_video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_401"
|
||||
|
||||
@@ -922,6 +922,22 @@ class MoGoAutopilotControlProvider :
|
||||
}
|
||||
}
|
||||
|
||||
override fun setIsSubscribeM1StitchedVideo(isSubscribe: Boolean) {
|
||||
if (isSubscribe) {
|
||||
AdasManager.getInstance().subscribeInterface(
|
||||
Constants.TERMINAL_ROLE.DRIVER,
|
||||
Constants.SUBSCRIBE_TYPE.SUBSCRIBE,
|
||||
MessageType.TYPE_RECEIVE_M1_STITCHED_VIDEO
|
||||
)
|
||||
} else {
|
||||
AdasManager.getInstance().subscribeInterface(
|
||||
Constants.TERMINAL_ROLE.DRIVER,
|
||||
Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE,
|
||||
MessageType.TYPE_RECEIVE_M1_STITCHED_VIDEO
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean {
|
||||
return AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(switchCmd)
|
||||
}
|
||||
|
||||
@@ -742,6 +742,20 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* M1拼接视频 10Hz
|
||||
* 此接口需要订阅,默认不发送数据
|
||||
* 订阅调用:{@link AdasManager#subscribeInterface(int, int, MessageType)}
|
||||
* 订阅参数:AdasManager.getInstance().subscribeInterface(Constants.TERMINAL_ROLE.DRIVER, Constants.SUBSCRIBE_TYPE.SUBSCRIBE, MessageType。TYPE_RECEIVE_M1_STITCHED_VIDEO);
|
||||
* 取消订阅参数:AdasManager.getInstance().subscribeInterface(Constants.TERMINAL_ROLE.DRIVER, Constants.SUBSCRIBE_TYPE.UNSUBSCRIBE, MessageType。TYPE_RECEIVE_M1_STITCHED_VIDEO);
|
||||
*
|
||||
* @param header 头
|
||||
* @param data 数据
|
||||
*/
|
||||
override fun onM1StitchedVideo(header: MessagePad.Header, data: ByteArray) {
|
||||
CallerRoboBusJinlvM1StitchedVideoListenerManager.invokeRoboBusJinlvM1StitchedVideo(data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可以启动自动驾驶
|
||||
* 使用方法查看:app_ipc_monitoring/uiMainActivity/onAutopilotAbility
|
||||
|
||||
@@ -15,31 +15,34 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoRoboBusJinlvM1StitchedVideoListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianBackCameraVideoListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerRoboBusJinlvM1StitchedVideoListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerSweeperFutianBackCameraVideoListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp;
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
|
||||
|
||||
/**
|
||||
* 清扫车摄像头展示View
|
||||
* 清扫车摄像头展示View 10Hz
|
||||
* M1拼接视频展示View 10Hz 需要订阅此数据:CallerAutoPilotControlManager.setIsSubscribeM1StitchedVideo(isSubscribe)
|
||||
*/
|
||||
public class SweeperVideoView extends AppCompatImageView implements IMoGoSweeperFutianBackCameraVideoListener {
|
||||
private static final String TAG = SweeperVideoView.class.getSimpleName();
|
||||
public class MogoVideoView extends AppCompatImageView implements IMoGoSweeperFutianBackCameraVideoListener, IMoGoRoboBusJinlvM1StitchedVideoListener {
|
||||
private static final String TAG = MogoVideoView.class.getSimpleName();
|
||||
private final RequestOptions requestOptions = new RequestOptions()
|
||||
.priority(Priority.HIGH)
|
||||
.skipMemoryCache(true)
|
||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||
.dontAnimate();
|
||||
|
||||
public SweeperVideoView(@NonNull Context context) {
|
||||
public MogoVideoView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public SweeperVideoView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
public MogoVideoView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public SweeperVideoView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
public MogoVideoView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@@ -47,12 +50,14 @@ public class SweeperVideoView extends AppCompatImageView implements IMoGoSweeper
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
CallerSweeperFutianBackCameraVideoListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerRoboBusJinlvM1StitchedVideoListenerManager.INSTANCE.addListener(TAG, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
CallerSweeperFutianBackCameraVideoListenerManager.INSTANCE.removeListener(this);
|
||||
CallerRoboBusJinlvM1StitchedVideoListenerManager.INSTANCE.removeListener(this);
|
||||
}
|
||||
|
||||
private final CustomTarget<Bitmap> target = new CustomTarget<Bitmap>() {
|
||||
@@ -60,7 +65,7 @@ public class SweeperVideoView extends AppCompatImageView implements IMoGoSweeper
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
//回调内容
|
||||
if (!resource.isRecycled()) {
|
||||
SweeperVideoView.this.setImageBitmap(resource);
|
||||
MogoVideoView.this.setImageBitmap(resource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,18 +75,28 @@ public class SweeperVideoView extends AppCompatImageView implements IMoGoSweeper
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianBackCameraVideo(@NonNull byte[] data) {
|
||||
private void draw(@NonNull byte[] data) {
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
GlideApp.with(SweeperVideoView.this)
|
||||
GlideApp.with(MogoVideoView.this)
|
||||
.asBitmap()
|
||||
.load(data)
|
||||
.placeholder(SweeperVideoView.this.getDrawable())
|
||||
.placeholder(MogoVideoView.this.getDrawable())
|
||||
.apply(requestOptions)
|
||||
.into(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSweeperFutianBackCameraVideo(@NonNull byte[] data) {
|
||||
draw(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRoboBusJinlvM1StitchedVideo(@NonNull byte[] data) {
|
||||
draw(data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -367,6 +367,12 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider {
|
||||
*/
|
||||
fun setIsDrawPointCloud(isDrawPointCloud: Boolean)
|
||||
|
||||
/**
|
||||
* 设置M1拼接视频接口订阅
|
||||
* @param isSubscribe 是否订阅
|
||||
*/
|
||||
fun setIsSubscribeM1StitchedVideo(isSubscribe: Boolean)
|
||||
|
||||
fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean
|
||||
|
||||
fun sendRoboBusJinlvM1AirConditionerCmd(
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.eagle.core.function.api.autopilot
|
||||
|
||||
/**
|
||||
* M1拼接视频 10Hz
|
||||
*/
|
||||
interface IMoGoRoboBusJinlvM1StitchedVideoListener {
|
||||
/**
|
||||
* 金旅M1拼接视频数据 10Hz 每一帧为一张图片
|
||||
*/
|
||||
fun onRoboBusJinlvM1StitchedVideo(data: ByteArray)
|
||||
}
|
||||
@@ -511,6 +511,14 @@ object CallerAutoPilotControlManager {
|
||||
providerApi?.setIsDrawPointCloud(isDrawPointCloud)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置M1拼接视频接口订阅
|
||||
* @param isSubscribe 是否订阅
|
||||
*/
|
||||
fun setIsSubscribeM1StitchedVideo(isSubscribe: Boolean) {
|
||||
providerApi?.setIsSubscribeM1StitchedVideo(isSubscribe)
|
||||
}
|
||||
|
||||
fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean {
|
||||
return providerApi?.sendRoboBusJinlvM1FrontDoorCmd(switchCmd) ?: false
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoRoboBusJinlvM1StitchedVideoListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
* 清扫车(福田)后摄像头视频数据
|
||||
*/
|
||||
object CallerRoboBusJinlvM1StitchedVideoListenerManager : CallerBase<IMoGoRoboBusJinlvM1StitchedVideoListener>() {
|
||||
|
||||
/**
|
||||
* 后摄像头视频数据
|
||||
*/
|
||||
fun invokeRoboBusJinlvM1StitchedVideo(data: ByteArray) {
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onRoboBusJinlvM1StitchedVideo(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.mogo.eagle.core.function.call.autopilot
|
||||
|
||||
import chassis.ChassisStatesOuterClass
|
||||
import chassis.VehicleStateOuterClass
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianBackCameraVideoListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoSweeperFutianCleanSystemListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user