import java.util.ArrayList;
import java.util.List;
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.Callback;
import org.json.JSONArray;
import org.json.JSONObject;
public class TestSo
{
public interface AlgrithmLib extends Library
{
interface PlatCbFuncInter extends Callback
{
int PlatCbFunc(String sBuf);
}
int ALGRITHM_Start();
int ALGRITHM_Stop();
int ALGRITHM_Exec(String sJsonBuf);
void ALGRITHM_RegPlatCbFunc(PlatCbFuncInter callback);
void ALGRITHM_DoPlatCbFunc(String sBuf);
}
public interface MongocLib extends Library
{
MongocLib INSTANCE = (MongocLib)Native.loadLibrary("mongoc-1.0", MongocLib.class);
void mongoc_stub();
}
public interface BsonLib extends Library
{
BsonLib INSTANCE = (BsonLib)Native.loadLibrary("bson-1.0", BsonLib.class);
void bson_stub();
}
public static void main(String[] args)
{
MongocLib.INSTANCE.mongoc_stub();
BsonLib.INSTANCE.bson_stub();
AlgrithmLib cAlgrithmLib = (AlgrithmLib)Native.loadLibrary("algrithm", AlgrithmLib.class);
AlgrithmLib.PlatCbFuncInter callback = new AlgrithmLib.PlatCbFuncInter()
{
public int PlatCbFunc(String sBuf)
{
System.out.printf("%s\n", sBuf);
return 0;
}
};
cAlgrithmLib.ALGRITHM_RegPlatCbFunc(callback);
//String sBuf = "123";
//cAlgrithmLib.ALGRITHM_DoPlatCbFunc(sBuf);
cAlgrithmLib.ALGRITHM_Start();
JSONObject jsonObjectFirst = new JSONObject();
JSONArray jsonArrayFirst = new JSONArray();
jsonObjectFirst.put("sCommandId", "1");
jsonObjectFirst.put("sCommandData", jsonArrayFirst);
JSONObject jsonObjectSecond = new JSONObject();
jsonObjectSecond.put("sUserId", "1");
jsonObjectSecond.put("sCommandType", "GetLocation");
jsonObjectSecond.put("sTimeBegin", "2017-10-17 22:00:00");
jsonObjectSecond.put("sTimeEnd", "2017-10-17 22:30:00");
jsonArrayFirst.put(jsonObjectSecond);
JSONObject jsonObjectThird = new JSONObject();
jsonObjectThird.put("sUserId", "2");
jsonObjectThird.put("sCommandType", "GetActivityWarn");
jsonObjectThird.put("sTimeBegin", "2017-10-17 22:00:00");
jsonObjectThird.put("sTimeEnd", "2017-10-17 22:30:00");
jsonArrayFirst.put(jsonObjectThird);
cAlgrithmLib.ALGRITHM_Exec(jsonObjectFirst.toString());
while(true)
{
}
}
}
jna_test.rar_JNA JAVA C_jna_jna 函数
版权申诉
148 浏览量
2022-09-15
00:12:36
上传
评论
收藏 1.4MB RAR 举报
weixin_42651887
- 粉丝: 75
- 资源: 1万+
最新资源
- tesseract安装包
- 1_32陀螺仪舵机.zip
- HITJ0302MP-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- XILINXFPGA源码PCIExpress标准概述
- HITJ0204MP-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- XILINXFPGA源码PCIExpressIP核应用参考设计
- XILINXFPGA源码LCD12864在Spartan-3E实现代码
- XILINXFPGA源码LCDIPCORE
- G6402-VB一款SOT23封装P-Channel场效应MOS管
- XILINXFPGA源码IPcamera的开源系统
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈