[m1] 添加M1拼接视频数据订阅接口、清扫车摄像头View和M1摄像头View共用
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user