|
|
@ -1,5 +1,6 @@ |
|
|
|
package utils; |
|
|
|
package utils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.sun.jna.NativeLong; |
|
|
|
import com.sun.jna.NativeLong; |
|
|
|
import com.sun.jna.ptr.IntByReference; |
|
|
|
import com.sun.jna.ptr.IntByReference; |
|
|
@ -12,13 +13,23 @@ import java.util.Date; |
|
|
|
public class CameraUtil { |
|
|
|
public class CameraUtil { |
|
|
|
public static void main(String[] args) { |
|
|
|
public static void main(String[] args) { |
|
|
|
|
|
|
|
|
|
|
|
// NetLib.instance.Net_Init(null, null);
|
|
|
|
NetLib.instance.Net_Init(null, null); |
|
|
|
|
|
|
|
|
|
|
|
run_device_cfg cfg = new run_device_cfg(); |
|
|
|
String strIp="192.168.1.64"; |
|
|
|
cfg.startCfg(); |
|
|
|
int nPort= 27778; |
|
|
|
|
|
|
|
String strUsername="admin"; |
|
|
|
|
|
|
|
String strPassword="admin123"; |
|
|
|
|
|
|
|
String strDevSN="8R23R300003"; |
|
|
|
|
|
|
|
IntByReference nError = new IntByReference(0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NativeLong loginID = NetLib.instance.Net_LoginDevice(strIp, nPort, strUsername, strPassword, null, nError); |
|
|
|
|
|
|
|
System.out.println("loginID = "+loginID); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 重启设备 |
|
|
|
|
|
|
|
*/ |
|
|
|
public static boolean deal(NativeLong loginID){ |
|
|
|
public static boolean deal(NativeLong loginID){ |
|
|
|
boolean res = NetLib.instance.Net_RebootDevice(loginID); |
|
|
|
boolean res = NetLib.instance.Net_RebootDevice(loginID); |
|
|
|
int error = NetLib.instance.Net_LastError(); |
|
|
|
int error = NetLib.instance.Net_LastError(); |
|
|
@ -26,6 +37,22 @@ public class CameraUtil { |
|
|
|
return res; |
|
|
|
return res; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取4G信号强度 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static int get4gRssiLevel(NativeLong loginID){ |
|
|
|
|
|
|
|
NetStructs.STU_GET_4G_RSSI_IN_PARAM.ByReference pstInParam = new NetStructs.STU_GET_4G_RSSI_IN_PARAM.ByReference(); |
|
|
|
|
|
|
|
NetStructs.STU_GET_4G_RSSI_OUT_PARAM.ByReference pstOutParam = new NetStructs.STU_GET_4G_RSSI_OUT_PARAM.ByReference(); |
|
|
|
|
|
|
|
boolean res = NetLib.instance.Net_GetDevice4GRSSI(loginID,pstInParam, pstOutParam,6000); |
|
|
|
|
|
|
|
int level = 0; |
|
|
|
|
|
|
|
if(res){ |
|
|
|
|
|
|
|
// System.out.println(JSON.toJSONString(pstOutParam));
|
|
|
|
|
|
|
|
// System.out.println("4G信号强度:"+pstOutParam.nRssiLevel);
|
|
|
|
|
|
|
|
level = pstOutParam.nRssiLevel; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return level; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void sleep(int nTime) |
|
|
|
private static void sleep(int nTime) |
|
|
|
{ |
|
|
|
{ |
|
|
|
try { |
|
|
|
try { |
|
|
|