在C ++中我有这个结构
typedef struct
{
char* sensorDataBuffer;
int sensorDataBufferSize;
} SALDetections;
它已经自动将char *转换为String,如下所示:
public void setSensorDataBuffer(String value) {
SALJNI.SALDetections_sensorDataBuffer_set(swigCPtr, this, value);
}
public String getSensorDataBuffer() {
return SALJNI.SALDetections_sensorDataBuffer_get(swigCPtr, this);
}
我应该如何编写接口脚本以将char *转换为byte []?
我尝试了这些代码,我在网上找到了这些代码,但它无效。
%typemap(jni) char *sensorDataBuffer "jbyteArray"
%typemap(jtype) char *sensorDataBuffer "byte[]"
%typemap(jstype) char *sensorDataBuffer "byte[]"
%typemap(javaout) char *sensorDataBuffer {
return $jnicall;
}