指令流引擎事件通知

场景介绍

接收指令流引擎上报的事件并处理。

前提条件

指令流引擎启动成功。

开发流程

在onVmiEngineEvent回调函数,处理不同错误码。

编码实例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
public void onVmiEngineEvent (int event, int reserved0, int reserved1, int reserved2, int reserved3, String additionInfo) {
    if (event == InstructionEngine.VMI_ENGINE_EVENT_SOCK_DISCONN) {
        // 网络断开
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                // 停止逻辑线程
                stopMonitorBlocked();
                if (upstreamReceiveDispatcher != null) {
                    upstreamReceiveDispatcher.stopBlocked();
                    upstreamReceiveDispatcher = null;
                }
                
                // 执行指令流重连流程的开发章节的重连流程
                // 或者退出云手机
            }
        });
    }
}