native层JNI函数映射java方法

2022-07-06  本文已影响0人  大胡子的机器人

以MirRgbdApp项目为例,可以看到vative_realsense.cpp中有映射java层(RGBDSensor.kt)调用的方法

JNINativeMethod logMethods[] = { {"updateRealSenseFw" , "(Ljava/lang/String;[B)Z", reinterpret_cast<void*>(updateFw)}, {"getRealSenseRGBDSerial", "()[Ljava/lang/String;",reinterpret_cast<void*>(getSerial)}, {"setRealSenseRGBD","(ILjava/lang/String;I)Z",reinterpret_cast<void*>(setRGBD)}, {"updateRealSenseRGBD","(ILjava/lang/String;)Z",reinterpret_cast<void*>(updateRGBD)}, {"startRealSenseRGBD","()Z",reinterpret_cast<void*>(startRGBD)}, {"openRealSenseRGBD","()Z", reinterpret_cast<void*>(openRGBD)}, {"closeRealSenseRGBD", "()V", reinterpret_cast<void*>(closeRGBD)}, {"getRealSenseLastError", "()Ljava/lang/String;", reinterpret_cast<void*>(getLastError)}, {"checkUpdateFw", "(Ljava/lang/String;)Z", reinterpret_cast<void*>(checkUpdateFw)}, {"setParkingMode", "(Z)V", reinterpret_cast<void*>(setParkingMode)} };

这里其实有很多参数是看不懂的,你看比如【(Ljava/lang/String;)Z】,这就需要对照表


image.png image.png

参考参数对应java层的

https://blog.csdn.net/weixin_31767183/article/details/78469707

上一篇下一篇

猜你喜欢

热点阅读