Initialize
Function Usage
Initializes the instruction stream engine client. The
Restrictions
N/A
Prototype
uint32_t Initialize(OnVmiEngineEvent event)
Parameters
Field Name |
Input/Output |
Field Type |
Description |
|---|---|---|---|
event |
Input |
OnVmiEngineEvent |
Pointer to the event callback function of the instruction stream engine. The prototype is as follows: using OnVmiEngineEvent = void (*)(EngineEvent event); EngineEvent is an instruction stream engine event. The prototype is as follows: typedef struct EngineEvent { int event = 0; int para1 = 0; int para2 = 0; int para3 = 0; int para4 = 0; char additionInfo[4096] = {0}; } EngineEvent; event indicates the engine event code. The options are as follows: enum VmiEngineEvent { VMI_ENGINE_EVENT_SOCK_DISCONN = -2, // The connection is interrupted. VMI_ENGINE_EVENT_PKG_BROKEN = -3, // The data packet is broken. VMI_ENGINE_EVENT_VERSION_ERROR = -4, // The server and client versions do not match. VMI_ENGINE_EVENT_READY = -5, // The instruction stream engine renders the first frame successfully. VMI_ENGINE_EVENT_ORIENTATION_CHANGED = -6, // The server orientation is changed. VMI_ENGINE_EVENT_CACHE_OVERFLOW = -7, // Cache overflow VMI_ENGINE_EVENT_BAD_LATENCY = -8, // Long network latency VMI_ENGINE_EVENT_NEW_CONNECTION = -9, // A new connection request is received. VMI_ENGINE_EVENT_TRAFFIC_ABNORMAL = -10, // Abnormal network traffic VMI_ENGINE_EVENT_APP_TRAFFIC_ABNORMAL = -11,// The traffic from the app to the SIPC is abnormal. VMI_ENGINE_EVENT_GET_VERSION_TIMEOUT = -12, // Obtaining the version number timed out. VMI_ENGINE_EVENT_VERSION_MISMATCH = -13, // Version mismatch VMI_ENGINE_EVENT_ENGINE_MISMATCH = -14, // Engine mismatch }; When the value of event is VMI_ENGINE_EVENT_ORIENTATION_CHANGED, para1 indicates the rotation orientation. The options are as follows:
|
Returns
Data type: uint32_t
The value can be:
- VMI_SUCCESS: The initialization is successful.
- VMI_CLIENT_EXEC_ORDER_FAIL: The engine execution order is invalid.
- VMI_CLIENT_INITIALIZE_FAIL: Failed to initialize the instruction stream engine client.
Example Call
void CallJavaOnVmiEngineEvent(EngineEvent event)
{
}
void Test()
{
uint32 initResult = Initialize(CallJavaOnVmiEngineEvent);
if (initResult != VMI_SUCCESS) {
// Failed to initialize the instruction stream engine. An error message and the exit page are displayed.
...
Log.e(TAG, "InstructionEngine initialize failed, result:" + initResult);
} else {
// Success.
...
}
}