void DispatchAction(
int
iActId) {
switch (iActId) {
case
1
: {
/
/
调用 DoTest1
CTLOG(
"准备执行 DoTest1..."
);
java_lang_String
*
pJsArg
=
new java_lang_String(g_pListener
-
>GetEntry());
pJsArg
-
>SetContent(
"hello world"
);
com_honeybadger_nativelib_NativeLib1
*
pThis
=
new com_honeybadger_nativelib_NativeLib1(g_pListener
-
>GetEntry());
vector<uint32_t> vecPara
=
{g_pListener
-
>GetJniEnvAddr(), pThis
-
>GetInstanceID(), pJsArg
-
>GetInstanceID()};
map
<uint32_t, uint64_t> mapResult;
g_pListener
-
>ExecJniInThread(true,
"Java_com_honeybadger_nativelib_NativeLib1_DoTest1"
,
3
, vecPara,
&mapResult);
uint32_t iOut
=
mapResult[ARM_REG_R0];
java_lang_String
*
pJsOut
=
(java_lang_String
*
) g_pListener
-
>GetEntry()
-
>GetVaClassInst()
-
>SearchClass_Inst(iOut);
string strOut
=
"执行 DoTest1 结束,结果:"
+
pJsOut
-
>GetContent();
CTLOG(strOut.c_str());
break
;
}
case
2
: {
CTLOG(
"准备执行 DoTest2..."
);
uint32_t iArg
=
100
;
com_honeybadger_nativelib_NativeLib1
*
pThis
=
new com_honeybadger_nativelib_NativeLib1(g_pListener
-
>GetEntry());
vector<uint32_t> vecPara
=
{g_pListener
-
>GetJniEnvAddr(), pThis
-
>GetInstanceID(), iArg};
map
<uint32_t, uint64_t> mapResult;
g_pListener
-
>ExecJniInThread(true,
"Java_com_honeybadger_nativelib_NativeLib1_DoTest2"
,
3
, vecPara,
&mapResult);
uint32_t iOut
=
mapResult[ARM_REG_R0];
string strOut
=
"执行 DoTest2 结束,结果:"
+
CPublicUtil::Int2String(iOut);
CTLOG(strOut.c_str());
break
;
}
case
3
:{
CTLOG(
"这里是继续添加其他函数的处理过程"
);
break
;
}
default: {
std::cout <<
"没有实现的函数"
<< std::flush;
break
;
}
}
}