init
commit
a4ef78b806
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,201 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.1</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<groupId>com.whdc</groupId>
|
||||
<artifactId>tiandy-service</artifactId>
|
||||
<version>1.0</version>
|
||||
<description>视频</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<!-- 使用阿里 maven 库 -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>ali-maven</id>
|
||||
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<version>2.7.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!-- mysql start-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.16</version>
|
||||
</dependency>
|
||||
<!-- mysql end-->
|
||||
|
||||
<!-- lombok start -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<!-- lombok end -->
|
||||
|
||||
<!-- fastjson start -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.80</version>
|
||||
</dependency>
|
||||
<!-- fastjson end-->
|
||||
|
||||
<!-- mybatisplus-plus start -->
|
||||
<dependency>
|
||||
<groupId>com.github.jeffreyning</groupId>
|
||||
<artifactId>mybatisplus-plus</artifactId>
|
||||
<version>1.7.0-RELEASE</version>
|
||||
</dependency>
|
||||
<!-- mybatisplus-plus end -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.whdc</groupId>
|
||||
<artifactId>AbsoluteLayout</artifactId>
|
||||
<version>1.0</version>
|
||||
<systemPath>${project.basedir}/lib/AbsoluteLayout.jar</systemPath>
|
||||
<scope>system</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.whdc</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<version>1.0</version>
|
||||
<systemPath>${project.basedir}/lib/jna.jar</systemPath>
|
||||
<scope>system</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.whdc</groupId>
|
||||
<artifactId>rt</artifactId>
|
||||
<version>1.0</version>
|
||||
<systemPath>${project.basedir}/lib/rt.jar</systemPath>
|
||||
<scope>system</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.whdc</groupId>
|
||||
<artifactId>swing-layout</artifactId>
|
||||
<version>1.0.3</version>
|
||||
<systemPath>${project.basedir}/lib/swing-layout-1.0.3.jar</systemPath>
|
||||
<scope>system</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>integration-ruoyi</artifactId>
|
||||
<version>3.8.8</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<groupId>io.swagger</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<groupId>io.swagger</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>springfox-swagger-common</artifactId>
|
||||
<groupId>io.springfox</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<groupId>io.springfox</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<groupId>io.springfox</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<groupId>org.mybatis</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
<groupId>com.baomidou</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.locationtech.jts</groupId>
|
||||
<artifactId>jts-core</artifactId>
|
||||
<version>1.18.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- 使用spring-boot-maven-plugin打包 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>com.whdc.TiandyApplication</mainClass>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.whdc;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.conf.EnableMPP;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
|
||||
/**
|
||||
* @author 李赛
|
||||
* @date 2022-06-26 0:17
|
||||
*/
|
||||
@Slf4j
|
||||
@EnableMPP
|
||||
@EnableWebMvc
|
||||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.whdc.mapper")
|
||||
public class TiandyApplication {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>> 启动程序 <<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||
|
||||
SpringApplication.run(TiandyApplication.class, args);
|
||||
} catch (BeansException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.whdc.callback;
|
||||
|
||||
|
||||
import com.whdc.dto.FrameInfo;
|
||||
|
||||
public interface DecodedDataCallback {
|
||||
void onDecodedDataReceived(int connectId, byte[] data, FrameInfo frameInfo);
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.whdc.callback;
|
||||
|
||||
|
||||
import com.whdc.dto.RawFrameInfo;
|
||||
|
||||
public interface RawFrameCallback {
|
||||
void onRawFrameReceived(int connectId, byte[] data, RawFrameInfo frameInfo);
|
||||
}
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.callback.RawFrameCallback;
|
||||
import com.whdc.dto.*;
|
||||
import com.whdc.service.impl.VideoStreamService;
|
||||
import com.whdc.service.impl.VideoSurveillanceService;
|
||||
import com.whdc.video.NVSSDK1;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/video")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class VideoController {
|
||||
|
||||
@Autowired
|
||||
private VideoSurveillanceService videoService;
|
||||
|
||||
@Autowired
|
||||
private VideoStreamService streamService;
|
||||
|
||||
private Integer currentConnectId = -1;
|
||||
|
||||
@PostMapping("/init")
|
||||
public ApiResponse<String> initSDK() {
|
||||
try {
|
||||
videoService.initSDK();
|
||||
return ApiResponse.success("SDK初始化成功");
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("SDK初始化失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
public ApiResponse<String> login(@RequestBody LoginRequest request) {
|
||||
try {
|
||||
boolean success = videoService.login(
|
||||
request.getIp(),
|
||||
request.getPort(),
|
||||
request.getUsername(),
|
||||
request.getPassword()
|
||||
);
|
||||
|
||||
if (success) {
|
||||
return ApiResponse.success("设备登录成功");
|
||||
} else {
|
||||
return ApiResponse.error("设备登录失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("登录异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/stream/start")
|
||||
public ApiResponse<String> startStream(@RequestBody StartStreamRequest request) {
|
||||
try {
|
||||
int m_iLogonID = request.getM_iServerID();
|
||||
if (m_iLogonID < 0 ) {
|
||||
return ApiResponse.error("请先登录设备");
|
||||
}
|
||||
|
||||
if (request.getChannelNo() < 0) {
|
||||
return ApiResponse.error("通道号参数错误");
|
||||
}
|
||||
if ((request.getStreamType() != 0 && request.getStreamType() != 1)) {
|
||||
return ApiResponse.error("码流类型参数错误 (0-主码流, 1-子码流)");
|
||||
}
|
||||
if (request.getNetMode() < 1) {
|
||||
return ApiResponse.error("网络模式参数错误");
|
||||
}
|
||||
|
||||
// 设置原始流回调
|
||||
videoService.setRawFrameCallback(currentConnectId, new RawFrameCallback() {
|
||||
@Override
|
||||
public void onRawFrameReceived(int connectId, byte[] data, RawFrameInfo frameInfo) {
|
||||
// 只处理视频帧
|
||||
if (frameInfo.getFrameType() == NVSSDK1.VI_FRAME ||
|
||||
frameInfo.getFrameType() == NVSSDK1.VP_FRAME) {
|
||||
streamService.storeFrame(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 使用默认参数启动视频流:通道0,主码流,TCP模式
|
||||
int connectId = videoService.startRealPlay(request.getChannelNo(), request.getStreamType(),request.getNetMode(),m_iLogonID);
|
||||
|
||||
if (connectId >= 0) {
|
||||
currentConnectId = connectId;
|
||||
return ApiResponse.success("视频流启动成功");
|
||||
} else {
|
||||
return ApiResponse.error("视频流启动失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("启动视频流异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/stream/stop")
|
||||
public ApiResponse<String> stopStream() {
|
||||
try {
|
||||
if (currentConnectId >= 0) {
|
||||
videoService.stopRealPlay(currentConnectId);
|
||||
streamService.cleanup();
|
||||
currentConnectId = -1;
|
||||
return ApiResponse.success("视频流停止成功");
|
||||
} else {
|
||||
return ApiResponse.error("没有活跃的视频流");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("停止视频流异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/ptz/control")
|
||||
public ApiResponse<String> controlPTZ(@RequestBody PTZControlRequest request) {
|
||||
try {
|
||||
if (!videoService.isLoggedIn()) {
|
||||
return ApiResponse.error("请先登录设备");
|
||||
}
|
||||
|
||||
boolean success = videoService.controlDirection(
|
||||
request.getChannelNo(),
|
||||
request.getDirection(),
|
||||
request.getSpeed()
|
||||
);
|
||||
|
||||
if (success) {
|
||||
String directionText = getDirectionText(request.getDirection());
|
||||
return ApiResponse.success("云台" + directionText + "控制成功");
|
||||
} else {
|
||||
return ApiResponse.error("云台控制失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("云台控制异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/ptz/stop")
|
||||
public ApiResponse<String> stopPTZ(@RequestBody PTZControlRequest request) {
|
||||
try {
|
||||
boolean success = videoService.controlDirection(
|
||||
request.getChannelNo(),
|
||||
NVSSDK1.PROTOCOL_MOVE_STOP,
|
||||
0
|
||||
);
|
||||
|
||||
if (success) {
|
||||
return ApiResponse.success("云台停止成功");
|
||||
} else {
|
||||
return ApiResponse.error("云台停止失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("云台停止异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public ApiResponse<String> logout() {
|
||||
try {
|
||||
// 先停止视频流
|
||||
if (currentConnectId >= 0) {
|
||||
videoService.stopRealPlay(currentConnectId);
|
||||
streamService.cleanup();
|
||||
currentConnectId = -1;
|
||||
}
|
||||
|
||||
videoService.logout();
|
||||
return ApiResponse.success("设备注销成功");
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("设备注销异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/status")
|
||||
public ApiResponse<Map<String, Object>> getStatus() {
|
||||
Map<String, Object> status = new HashMap<>();
|
||||
status.put("isLoggedIn", videoService.isLoggedIn());
|
||||
status.put("isStreaming", currentConnectId >= 0);
|
||||
status.put("isStreamActive", streamService.isStreamActive());
|
||||
|
||||
return ApiResponse.success(status);
|
||||
}
|
||||
|
||||
private String getDirectionText(Integer direction) {
|
||||
switch (direction) {
|
||||
case NVSSDK1.PROTOCOL_MOVE_UP: return "上";
|
||||
case NVSSDK1.PROTOCOL_MOVE_DOWN: return "下";
|
||||
case NVSSDK1.PROTOCOL_MOVE_LEFT: return "左";
|
||||
case NVSSDK1.PROTOCOL_MOVE_RIGHT: return "右";
|
||||
case NVSSDK1.PROTOCOL_MOVE_STOP: return "停止";
|
||||
default: return "未知方向";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.service.impl.VideoStreamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
|
||||
|
||||
@RestController
|
||||
public class VideoStreamController {
|
||||
|
||||
@Autowired
|
||||
private VideoStreamService streamService;
|
||||
|
||||
@GetMapping(value = "/video/stream", produces = "multipart/x-mixed-replace;boundary=frame")
|
||||
public ResponseEntity<StreamingResponseBody> getVideoStream() {
|
||||
StreamingResponseBody stream = outputStream -> {
|
||||
try {
|
||||
while (true) {
|
||||
byte[] frameData = streamService.getCurrentFrame();
|
||||
|
||||
if (frameData != null) {
|
||||
// 写入MJPEG帧
|
||||
outputStream.write(("--frame\r\n" +
|
||||
"Content-Type: image/jpeg\r\n" +
|
||||
"Content-Length: " + frameData.length + "\r\n" +
|
||||
"\r\n").getBytes());
|
||||
outputStream.write(frameData);
|
||||
outputStream.write("\r\n".getBytes());
|
||||
outputStream.flush();
|
||||
}
|
||||
|
||||
// 控制帧率
|
||||
Thread.sleep(100); // 10fps
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 连接断开时的处理
|
||||
System.out.println("视频流连接断开: " + e.getMessage());
|
||||
}
|
||||
};
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType("multipart/x-mixed-replace;boundary=frame"))
|
||||
.body(stream);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
public class ApiResponse<T> {
|
||||
private boolean success;
|
||||
private String message;
|
||||
private T data;
|
||||
|
||||
public ApiResponse(boolean success, String message, T data) {
|
||||
this.success = success;
|
||||
this.message = message;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static <T> ApiResponse<T> success(T data) {
|
||||
return new ApiResponse<>(true, "操作成功", data);
|
||||
}
|
||||
|
||||
public static <T> ApiResponse<T> success(String message, T data) {
|
||||
return new ApiResponse<>(true, message, data);
|
||||
}
|
||||
|
||||
public static <T> ApiResponse<T> error(String message) {
|
||||
return new ApiResponse<>(false, message, null);
|
||||
}
|
||||
|
||||
public boolean isSuccess() { return success; }
|
||||
public void setSuccess(boolean success) { this.success = success; }
|
||||
public String getMessage() { return message; }
|
||||
public void setMessage(String message) { this.message = message; }
|
||||
public T getData() { return data; }
|
||||
public void setData(T data) { this.data = data; }
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
/**
|
||||
* 解码后的帧信息DTO
|
||||
*/
|
||||
public class FrameInfo {
|
||||
private int width;
|
||||
private int height;
|
||||
private int timeStamp;
|
||||
private int frameType;
|
||||
private int frameRate;
|
||||
private Object reserved; // 保留字段
|
||||
|
||||
// 无参构造函数
|
||||
public FrameInfo() {
|
||||
}
|
||||
|
||||
// 全参构造函数
|
||||
public FrameInfo(int width, int height, int timeStamp, int frameType, int frameRate) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.timeStamp = timeStamp;
|
||||
this.frameType = frameType;
|
||||
this.frameRate = frameRate;
|
||||
}
|
||||
|
||||
// Getters and Setters
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getTimeStamp() {
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
public void setTimeStamp(int timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
public int getFrameType() {
|
||||
return frameType;
|
||||
}
|
||||
|
||||
public void setFrameType(int frameType) {
|
||||
this.frameType = frameType;
|
||||
}
|
||||
|
||||
public int getFrameRate() {
|
||||
return frameRate;
|
||||
}
|
||||
|
||||
public void setFrameRate(int frameRate) {
|
||||
this.frameRate = frameRate;
|
||||
}
|
||||
|
||||
public Object getReserved() {
|
||||
return reserved;
|
||||
}
|
||||
|
||||
public void setReserved(Object reserved) {
|
||||
this.reserved = reserved;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FrameInfo{" +
|
||||
"width=" + width +
|
||||
", height=" + height +
|
||||
", timeStamp=" + timeStamp +
|
||||
", frameType=" + frameType +
|
||||
", frameRate=" + frameRate +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LoginRequest {
|
||||
private String ip;
|
||||
private Integer port;
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PTZControlRequest {
|
||||
private Integer channelNo = 0;
|
||||
private Integer direction;
|
||||
private Integer speed = 50;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
/**
|
||||
* 原始帧信息DTO
|
||||
*/
|
||||
public class RawFrameInfo {
|
||||
private int width;
|
||||
private int height;
|
||||
private int timeStamp;
|
||||
private int frameType;
|
||||
private int encoderType;
|
||||
private int frameRate;
|
||||
private int absStamp;
|
||||
private byte bitsPerSample;
|
||||
private int samplesPerSec;
|
||||
|
||||
// 无参构造函数
|
||||
public RawFrameInfo() {
|
||||
}
|
||||
|
||||
// 全参构造函数
|
||||
public RawFrameInfo(int width, int height, int timeStamp, int frameType,
|
||||
int encoderType, int frameRate, int absStamp,
|
||||
byte bitsPerSample, int samplesPerSec) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.timeStamp = timeStamp;
|
||||
this.frameType = frameType;
|
||||
this.encoderType = encoderType;
|
||||
this.frameRate = frameRate;
|
||||
this.absStamp = absStamp;
|
||||
this.bitsPerSample = bitsPerSample;
|
||||
this.samplesPerSec = samplesPerSec;
|
||||
}
|
||||
|
||||
// Getters and Setters
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getTimeStamp() {
|
||||
return timeStamp;
|
||||
}
|
||||
|
||||
public void setTimeStamp(int timeStamp) {
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
public int getFrameType() {
|
||||
return frameType;
|
||||
}
|
||||
|
||||
public void setFrameType(int frameType) {
|
||||
this.frameType = frameType;
|
||||
}
|
||||
|
||||
public int getEncoderType() {
|
||||
return encoderType;
|
||||
}
|
||||
|
||||
public void setEncoderType(int encoderType) {
|
||||
this.encoderType = encoderType;
|
||||
}
|
||||
|
||||
public int getFrameRate() {
|
||||
return frameRate;
|
||||
}
|
||||
|
||||
public void setFrameRate(int frameRate) {
|
||||
this.frameRate = frameRate;
|
||||
}
|
||||
|
||||
public int getAbsStamp() {
|
||||
return absStamp;
|
||||
}
|
||||
|
||||
public void setAbsStamp(int absStamp) {
|
||||
this.absStamp = absStamp;
|
||||
}
|
||||
|
||||
public byte getBitsPerSample() {
|
||||
return bitsPerSample;
|
||||
}
|
||||
|
||||
public void setBitsPerSample(byte bitsPerSample) {
|
||||
this.bitsPerSample = bitsPerSample;
|
||||
}
|
||||
|
||||
public int getSamplesPerSec() {
|
||||
return samplesPerSec;
|
||||
}
|
||||
|
||||
public void setSamplesPerSec(int samplesPerSec) {
|
||||
this.samplesPerSec = samplesPerSec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RawFrameInfo{" +
|
||||
"width=" + width +
|
||||
", height=" + height +
|
||||
", timeStamp=" + timeStamp +
|
||||
", frameType=" + frameType +
|
||||
", encoderType=" + encoderType +
|
||||
", frameRate=" + frameRate +
|
||||
", absStamp=" + absStamp +
|
||||
", bitsPerSample=" + bitsPerSample +
|
||||
", samplesPerSec=" + samplesPerSec +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StartStreamRequest {
|
||||
|
||||
private int channelNo = 0; // 通道号 (从0开始)
|
||||
private int streamType = 0; // 码流类型 (0-主码流, 1-子码流)
|
||||
private int netMode = 1; // 网络模式 (1-TCP, 2-UDP, 6-RTSP over TCP等)
|
||||
private int m_iServerID = -1;
|
||||
}
|
||||
|
|
@ -0,0 +1,484 @@
|
|||
package com.whdc.playback;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.Structure.ByValue;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
|
||||
import com.sun.jna.Callback;
|
||||
|
||||
public interface NVSSDK extends Library {
|
||||
|
||||
public static final int WM_USER = 0x0400; //
|
||||
|
||||
public static final int WM_MAIN_MESSAGE = WM_USER + 1001; // system information
|
||||
public static final int WM_PARACHG = WM_USER + 1002; // parameter change message
|
||||
public static final int WM_ALARM = WM_USER + 1003; // alarm message
|
||||
public static final int WCM_ERR_ORDER = 2;
|
||||
public static final int WCM_ERR_DATANET = 3;
|
||||
public static final int WCM_LOGON_NOTIFY = 7;
|
||||
public static final int WCM_VIDEO_HEAD = 8;
|
||||
public static final int WCM_VIDEO_DISCONNECT = 9;
|
||||
public static final int WCM_RECORD_ERR = 13;
|
||||
public static final int WCM_QUERYFILE_FINISHED = 18;
|
||||
public static final int WCM_DWONLOAD_FINISHED = 19;
|
||||
public static final int WCM_DWONLOAD_FAULT = 20;
|
||||
public static final int WCM_DOWNLOAD_INTERRUPT = 29;
|
||||
|
||||
public static final int LOGON_SUCCESS = 0;
|
||||
public static final int LOGON_ING = 1;
|
||||
public static final int LOGON_RETRY = 2;
|
||||
public static final int LOGON_DSMING = 3;
|
||||
public static final int LOGON_FAILED = 4;
|
||||
public static final int LOGON_TIMEOUT = 5;
|
||||
public static final int NOT_LOGON = 6;
|
||||
public static final int LOGON_DSMFAILED = 7;
|
||||
public static final int LOGON_DSMTIMEOUT = 8;
|
||||
public static final int PLAYER_PLAYING = 0x02;
|
||||
public static final int USER_ERROR = 0x10000000;
|
||||
|
||||
public static final int MOVE_UP = 1;
|
||||
public static final int MOVE_UP_STOP = 2;
|
||||
public static final int MOVE_DOWN = 3;
|
||||
public static final int MOVE_DOWN_STOP = 4;
|
||||
public static final int MOVE_LEFT = 5;
|
||||
public static final int MOVE_LEFT_STOP = 6;
|
||||
public static final int MOVE_RIGHT = 7;
|
||||
public static final int MOVE_RIGHT_STOP = 8;
|
||||
public static final int MOVE_UP_LEFT = 9;
|
||||
public static final int MOVE_UP_LEFT_STOP = 10;
|
||||
public static final int MOVE_UP_RIGHT = 11;
|
||||
public static final int MOVE_UP_RIGHT_STOP = 12;
|
||||
public static final int MOVE_DOWN_LEFT = 13;
|
||||
public static final int MOVE_DOWN_LEFT_STOP = 14;
|
||||
public static final int MOVE_DOWN_RIGHT = 15;
|
||||
public static final int MOVE_DOWN_RIGHT_STOP = 16;
|
||||
|
||||
public static final int HOR_AUTO = 21;
|
||||
public static final int HOR_AUTO_STOP = 22;
|
||||
|
||||
public static final int ZOOM_BIG = 31;
|
||||
public static final int ZOOM_BIG_STOP = 32;
|
||||
public static final int ZOOM_SMALL = 33;
|
||||
public static final int ZOOM_SMALL_STOP = 34;
|
||||
public static final int FOCUS_FAR = 35;
|
||||
public static final int FOCUS_FAR_STOP = 36;
|
||||
public static final int FOCUS_NEAR = 37;
|
||||
public static final int FOCUS_NEAR_STOP = 38;
|
||||
public static final int IRIS_OPEN = 39;
|
||||
public static final int IRIS_OPEN_STOP = 40;
|
||||
public static final int IRIS_CLOSE = 41;
|
||||
public static final int IRIS_CLOSE_STOP = 42;
|
||||
public static final int LIGHT_ON = 43;
|
||||
public static final int LIGHT_OFF = 44;
|
||||
public static final int POWER_ON = 45;
|
||||
public static final int POWER_OFF = 46;
|
||||
public static final int RAIN_ON = 47;
|
||||
public static final int RAIN_OFF = 48;
|
||||
|
||||
public static final int MOVE = 60;
|
||||
public static final int MOVE_STOP = 61;
|
||||
public static final int CALL_VIEW = 62;
|
||||
public static final int SET_VIEW = 63;
|
||||
|
||||
public static final int ALARM_VDO_MOTION = 0;
|
||||
public static final int ALARM_VDO_REC = 1;
|
||||
public static final int ALARM_VDO_LOST = 2;
|
||||
public static final int ALARM_VDO_INPORT = 3;
|
||||
public static final int ALARM_VDO_OUTPORT = 4;
|
||||
public static final int ALARM_VDO_COVER = 5;
|
||||
public static final int ALARM_VCA_INFO = 6; // Intelligent analysis of alarm information
|
||||
|
||||
public static final int T_AUDIO8 = 0;
|
||||
public static final int T_YUV420 = 1;
|
||||
public static final int T_YUV422 = 2;
|
||||
|
||||
public static final int NET_PICSTREAM_CMD_VCA = 1; //Callback VCA image stream information
|
||||
public static final int NET_PICSTREAM_CMD_ITS = 2; //Callback ITS image stream information
|
||||
public static final int NET_PICSTREAM_CMD_FACE = 3; //Callback face image stream information
|
||||
public static final int NET_PICSTREAM_CMD_NORMALSNAP = 4; //Callback normal snap image stream information
|
||||
|
||||
//Front end video query
|
||||
public static final int CMD_NETFILE_QUERY_FILE = 0;
|
||||
public static final int CMD_NETFILE_ITS_QUERY_DATA = 1;
|
||||
public static final int CMD_NETFILE_ITS_GETTOTALCOUNT = 2;
|
||||
public static final int CMD_NETFILE_ITS_GETCURRENTCOUNT = 3;
|
||||
public static final int CMD_NETFILE_ITS_GETRESULT = 4;
|
||||
public static final int CMD_NETFILE_ITS_QUERY_TOTALCOUNT = 5;
|
||||
public static final int CMD_NETFILE_MULTI_CHANNEL_QUERY_FILE = 6;
|
||||
public static final int CMD_NETFILE_QUERY_VCA = 7;
|
||||
|
||||
public static final int DOWNLOAD_FLAG_FIRST_REQUEST = 0;
|
||||
public static final int DOWNLOAD_FLAG_OPERATE_RECORD = 1;
|
||||
public static final int DOWNLOAD_FLAG_BREAK_CONTINUE = 2;
|
||||
|
||||
public static final int DOWNLOAD_CMD_FILE = 0;
|
||||
public static final int DOWNLOAD_CMD_TIMESPAN = 1;
|
||||
public static final int DOWNLOAD_CMD_CONTROL = 2;
|
||||
public static final int DOWNLOAD_CMD_FILE_CONTINUE = 3;
|
||||
public static final int DOWNLOAD_CMD_GET_FILE_COUNT = 4;
|
||||
public static final int DOWNLOAD_CMD_GET_FILE_INFO = 5;
|
||||
public static final int DOWNLOAD_CMD_SET_FILE_INFO = 6;
|
||||
|
||||
//download file type
|
||||
public static final int DOWNLOAD_FILE_TYPE_SDV = 0;
|
||||
public static final int DOWNLOAD_FILE_TYPE_PS = 3;
|
||||
public static final int DOWNLOAD_FILE_TYPE_TS = 6;
|
||||
|
||||
public static final int VI_FRAME = 0;
|
||||
public static final int VP_FRAME = 1;
|
||||
public static final int AUDIO_FRAME = 5;
|
||||
|
||||
public static final int RAW_VIDEO_H264 = 1;
|
||||
public static final int RAW_VIDEO_MPEG4 = 2;
|
||||
public static final int RAW_VIDEO_MJPEG = 41;
|
||||
public static final int RAW_VIDEO_H265 = 23;
|
||||
|
||||
public static final int RAW_AUDIO_G711_A = 0x01;
|
||||
public static final int RAW_AUDIO_G711_U = 0x02;
|
||||
public static final int RAW_AUDIO_ADPCM_A = 0x03;
|
||||
public static final int RAW_AUDIO_AAC = 0x16;
|
||||
|
||||
|
||||
|
||||
public static class RECT extends Structure implements ByValue {
|
||||
public int left;
|
||||
public int top;
|
||||
public int right;
|
||||
public int bottom;
|
||||
}
|
||||
|
||||
public static class SDK_VERSION extends Structure {
|
||||
public short m_ulMajorVersion;
|
||||
public short m_ulMinorVersion;
|
||||
public short m_ulBuilder;
|
||||
public String m_cVerInfo;
|
||||
}
|
||||
|
||||
public static class CLIENTINFO extends Structure {
|
||||
public CLIENTINFO() {
|
||||
allocateMemory();
|
||||
}
|
||||
public int m_iServerID;
|
||||
public int m_iChannelNo;
|
||||
public byte[] m_cNetFile = new byte[255];
|
||||
public byte[] m_cRemoteIP = new byte[16];
|
||||
public int m_iNetMode;
|
||||
public int m_iTimeout;
|
||||
public int m_iTTL;
|
||||
public int m_iBufferCount;
|
||||
public int m_iDelayNum;
|
||||
public int m_iDelayTime;
|
||||
public int m_iStreamNO;
|
||||
public int m_iFlag;
|
||||
public int m_iPosition;
|
||||
public int m_iSpeed;
|
||||
}
|
||||
|
||||
|
||||
public static class ENCODERINFO extends Structure {
|
||||
public byte[] m_cHostName = new byte[32];
|
||||
public byte[] m_cEncoder = new byte[16];
|
||||
public int m_iRecvMode;
|
||||
public byte[] m_cProxy = new byte[16];
|
||||
public byte[] m_cFactoryID = new byte[32]; //ProductID
|
||||
public int m_iPort;//NVS port
|
||||
public int m_nvsType; //NVS type(NVS_T or NVS_S or DVR ...eg)
|
||||
public int m_iChanNum;
|
||||
public int m_iLogonState;
|
||||
public int m_iServerType;
|
||||
}
|
||||
|
||||
public static class PicTime extends Structure {
|
||||
|
||||
public int uiYear;
|
||||
public int uiMonth;
|
||||
public int uiDay;
|
||||
public int uiWeek;
|
||||
public int uiHour;
|
||||
public int uiMinute;
|
||||
public int uiSecondsr;
|
||||
public int uiMilliseconds;
|
||||
}
|
||||
|
||||
public static class PicData extends Structure {
|
||||
|
||||
public PicTime tPicTime;
|
||||
public int iDataLen;
|
||||
public Pointer pcPicData;
|
||||
}
|
||||
|
||||
public static class VcaPicStream extends Structure {
|
||||
|
||||
public int iStructLen;
|
||||
public int iWidth;
|
||||
public int iHeight;
|
||||
public int iChannelID;
|
||||
public int iEventType;
|
||||
public int iRuleID;
|
||||
public int iTargetID;
|
||||
public int iTargetType;
|
||||
public int iTargetSpeed;
|
||||
public int iTargetDirection;
|
||||
public RECT tTargetPosition;
|
||||
public int iPresetNo;
|
||||
public byte[] m_cRemoteIP = new byte[16];
|
||||
public int iPicCount;
|
||||
public PicData[] tPicData = new PicData[3];
|
||||
}
|
||||
|
||||
public static class FaceAttribute extends Structure {
|
||||
public int iType;
|
||||
public int iValue;
|
||||
}
|
||||
|
||||
public static class FacePicData extends Structure {
|
||||
|
||||
public int iFaceId;
|
||||
public int iDrop;
|
||||
public int iFaceLevel;
|
||||
public RECT tFaceRect;
|
||||
public int iWidth;
|
||||
public int iHeight;
|
||||
public int iFaceAttrCount; //Number of face attributes
|
||||
public int iFaceAttrStructSize; //The size of strcut FaceAttribute
|
||||
public Pointer[] ptFaceAttr = new Pointer[256]; //Face attributes,supports up to 256 attribute types,the subscript is the face attribute type://0-age,1-gender,2-masks,3-beard,4-eye open,5-mouth,6-glasses,7-race,8-emotion,9-smile,10-value......
|
||||
public int iDataLen;
|
||||
public Pointer pcPicData;
|
||||
}
|
||||
|
||||
public static class FacePicStream extends Structure {
|
||||
|
||||
public int iStructLen;
|
||||
public int iSizeOfFull; //The size of strcut PicData
|
||||
public Pointer tFullData;
|
||||
public int iFaceCount;
|
||||
public int iSizeOfFace; //The size of strcut FacePicData
|
||||
public Pointer[] tPicData = new Pointer[32];
|
||||
}
|
||||
|
||||
public static class PICSTREAM_INFO extends Structure {
|
||||
|
||||
public byte[] RecvBuffer = new byte[200*1024];//400 here should not be less than the maximum alarm message length
|
||||
}
|
||||
|
||||
|
||||
public static interface MAIN_NOTIFY extends Callback {
|
||||
void MainNotify(int _iLogonID, int _iwParam, Pointer _ilParam,
|
||||
Pointer _pUserData);
|
||||
}
|
||||
|
||||
public static interface ALARM_NOTIFY extends Callback {
|
||||
void AlarmNotify(int _iLogonID, int _iChannel,
|
||||
int _iAlarmState, int _iAlarmType, Pointer _pUserData);
|
||||
}
|
||||
|
||||
public static interface PARACHANGE_NOTIFY extends Callback {
|
||||
void ParaChangeNotify(int _iLogonID, int _iChannel, int _iParaType,
|
||||
Pointer _strPara, Pointer _pUserData);
|
||||
}
|
||||
|
||||
public static interface COMRECV_NOTIFY extends Callback {
|
||||
void ComRecvNotify(int _iLogonID, Pointer _pData, int _iLen,
|
||||
int _iComNo, Pointer _pUserData);
|
||||
}
|
||||
|
||||
public static interface PROXY_NOTIFY extends Callback {
|
||||
void ProxyNotify(int _iLogonID, int _iCmdKey, Pointer _pData,
|
||||
int _iLen, Pointer _pUserData);
|
||||
}
|
||||
|
||||
public static interface RECVDATA_NOTIFY extends StdCallCallback {
|
||||
void RecvDataNotify(int _ulID, Pointer _ucData, int _iLen, int _iFlag,
|
||||
Pointer _lpUserData);
|
||||
}
|
||||
|
||||
public static interface NET_PICSTREAM_NOTIFY extends StdCallCallback {
|
||||
int PicDataNotify(int _ulID, int _lCommand, Pointer _tInfo, int _iLen,
|
||||
Pointer _lpUserData);
|
||||
}
|
||||
|
||||
public static class NetPicPara extends Structure {
|
||||
public int iStructLen; //Structure length
|
||||
public int iChannelNo;
|
||||
public NET_PICSTREAM_NOTIFY cbkPicStreamNotify;
|
||||
public Pointer pvUser;
|
||||
}
|
||||
|
||||
public static class PointerSize extends Structure {
|
||||
public Pointer pPointer;
|
||||
}
|
||||
|
||||
public static class NVS_FILE_TIME extends Structure implements ByValue {
|
||||
public short iYear; // Year
|
||||
public short iMonth; // Month
|
||||
public short iDay; // Day
|
||||
public short iHour; // Hour
|
||||
public short iMinute; // Minute
|
||||
public short iSecond; // Second
|
||||
}
|
||||
|
||||
public static class QueryFileChannel extends Structure{
|
||||
public int iChannelNo;
|
||||
public int iStreamNo;
|
||||
}
|
||||
|
||||
public static class ArrayQueryFileChannel extends Structure {
|
||||
public QueryFileChannel[] tArry = new QueryFileChannel[2];
|
||||
}
|
||||
|
||||
public static class NETFILE_QUERY_V5 extends Structure {
|
||||
public int iBufSize; //Size of the structure
|
||||
public int iQueryChannelNo; //query channel no, 0x7FFFFFFF means query all channel
|
||||
public int iStreamNo; //stream no
|
||||
public int iType; //Video type 33:ATM
|
||||
public NVS_FILE_TIME tStartTime; //Start time
|
||||
public NVS_FILE_TIME tStopTime; //End time
|
||||
public int iPageSize; //Page size
|
||||
public int iPageNo; //Page number
|
||||
public int iFiletype; //File type 0:all,1:Video,2:picture
|
||||
public int iDevType; //Device type 0:Video camera,1:Network video server,2:Web camera ,0xff: all
|
||||
public byte[] cOtherQuery = new byte[65]; //Character overlay
|
||||
public int iTriggerType; //Alarm type 3:Port alarm,4:Mobile alarm ,5:Video loss alarm ,0x7FFFFFFF:invalid
|
||||
public int iTrigger; //Port(channel)number
|
||||
public int iQueryType; //Query type 0: Basic query 1:ATM query 2: ITS query
|
||||
public int iQueryCondition; //Query criteria 0: Domain query 1: According to the card number query ; 2: Traffic query condition:
|
||||
public byte[] cField = new byte[5 * 68]; //Query message
|
||||
public int iQueryChannelCount; //if iQueryChannelCount = 0, query single channel with iQueryChannelNo
|
||||
public int iBufferSize; //sizeof(QueryFileChannel)
|
||||
public Pointer ptChannelList; //buffer len = sizeof(QueryFileChannel)*iQueryChannelCount
|
||||
public byte[] cLaneNo = new byte[65]; //lane no
|
||||
public byte[] cVehicleType = new byte[65]; //vehicle type
|
||||
public int iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage
|
||||
}
|
||||
|
||||
//Record File Property
|
||||
public static class NVS_FILE_DATA extends Structure {
|
||||
public int iType; //Record type 1-Manual record, 2-Schedule record, 3-Alarm record
|
||||
public int iChannel; //Record channel 0~channel defined channel number
|
||||
public byte[] cFileName = new byte[250]; //File name
|
||||
public NVS_FILE_TIME tStartTime; //File start time
|
||||
public NVS_FILE_TIME tStopTime; //File end time
|
||||
public int iFileSize; //File size
|
||||
};
|
||||
|
||||
public static class NVS_FILE_DATA_EX extends Structure {
|
||||
public int iSize;
|
||||
public NVS_FILE_DATA tFileData; //file basic information
|
||||
public int iLocked; //add unlock state
|
||||
public int iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage
|
||||
};
|
||||
|
||||
public static class DOWNLOAD_FILE extends Structure {
|
||||
public int m_iSize; //Structure size
|
||||
public byte[] m_cRemoteFilename = new byte[255]; //Fornt end video file name
|
||||
public byte[] m_cLocalFilename = new byte[255]; //Local video file name
|
||||
public int m_iPosition; //File location by percentage 0~100;When continue send after stop send,file pointer offset request
|
||||
public int m_iSpeed; //1, 2, 4, 8, Control file play speed, 0-Suspend
|
||||
public int m_iIFrame; //Only send I frame 1,Only play I Frame;0, All play
|
||||
public int m_iReqMode; //Require data mode 1,Frame mode;0,Stream mode
|
||||
public int m_iRemoteFileLen; //If local file is not null, the parameter set to null
|
||||
public int m_iVodTransEnable; //Enable
|
||||
public int m_iVodTransVideoSize; //Video pixel
|
||||
public int m_iVodTransFrameRate; //Frame rate
|
||||
public int m_iVodTransStreamRate; //Code rate
|
||||
public int m_iSaveFileType; //0:SDV 3:ps
|
||||
public int m_iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage
|
||||
public int m_iCryptType; //iCryptType = 0, no encryption; iCryptType = 1, is AES encryption
|
||||
public byte[] m_cCryptKey = new byte[32];
|
||||
};
|
||||
|
||||
public static class DOWNLOAD_TIMESPAN extends Structure {
|
||||
public int m_iSize; //Structure size
|
||||
public byte[] m_cLocalFilename = new byte[255]; //Local video file name
|
||||
public int m_iChannelNO; //Channel number
|
||||
public NVS_FILE_TIME m_tTimeBegin; //Start time
|
||||
public NVS_FILE_TIME m_tTimeEnd; //End time
|
||||
public int m_iPosition; //Position according to time point,>100
|
||||
public int m_iSpeed; //1, 2, 4, 8, Control file playback speed, 0-Suspend
|
||||
public int m_iIFrame; //Only I frames 1,I only play; 0,Full play
|
||||
public int m_iReqMode; //Required data model 1,Frame mode;0,Flow pattern
|
||||
public int m_iVodTransEnable; //Enable
|
||||
public int m_iVodTransVideoSize; //Video frequency ratio
|
||||
public int m_iVodTransFrameRate; //Frame rate
|
||||
public int m_iVodTransStreamRate; //Code Rate
|
||||
public int m_iFileFlag; //0:Download multiple files 1:Download into a single file
|
||||
public int m_iSaveFileType; //0:SDV 3:ps
|
||||
public int m_iStreamNo; //stream number,0-main stream, 1-sub stream
|
||||
public int m_iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage
|
||||
public int m_iCryptType; //iCryptType = 0, no encryption; iCryptType = 1, is AES encryption
|
||||
public byte[] m_cCryptKey = new byte[32];
|
||||
};
|
||||
|
||||
public static class DOWNLOAD_CONTROL extends Structure {
|
||||
public int m_iSize; //Structure size
|
||||
public int m_iPosition; //0~100, Location file playback ; -1, Does not carry on the localization
|
||||
public int m_iSpeed; //1, 2, 4, 8, Control file playback speed, 0-Suspend
|
||||
public int m_iIFrame; //Only I frames 1,I only play;0,Full play
|
||||
public int m_iReqMode; //Demand data model 1,Frame mode ;0,Flow pattern
|
||||
};
|
||||
|
||||
public static class RAWFRAME_INFO extends Structure {
|
||||
public int nWidth; //Video width, audio data is 0
|
||||
public int nHeight; //Video height, audio data is 0
|
||||
public int nStamp; //Time stamp(ms)
|
||||
public int nType; //RAWFRAMETYPE, I Frame:0,P Frame:1,B Frame:2,Audio:5
|
||||
public int nEnCoder; //Audio or Video encoder(Video,0:H263,1:H264, 2:MP4. Audio:0,G711_A:0x01,G711_U:0x02,ADPCM_A:0x03,G726:0x04)
|
||||
public int nFrameRate; //Frame rate
|
||||
public int nAbsStamp; //Absolute Time(s)
|
||||
public byte ucBitsPerSample; // bit per sample [8/16/24] default 16
|
||||
public int uiSamplesPerSec; // Samples Per Sec, default 8000
|
||||
};
|
||||
|
||||
//Not decode the standard data before the pure h264 data
|
||||
public static interface RAWFRAME_NOTIFY extends StdCallCallback {
|
||||
void rawFrameNotify(int _uiID, Pointer _pcData, int _iLen, RAWFRAME_INFO _ptRawFrameInfo, Pointer _pvUsrData);
|
||||
}
|
||||
|
||||
int NetClient_GetVersion(SDK_VERSION _ver);
|
||||
|
||||
int NetClient_SetNotifyFunction_V4(MAIN_NOTIFY _cbkMainNotify,
|
||||
ALARM_NOTIFY _cbkAlarmNotify,
|
||||
PARACHANGE_NOTIFY _cbkParaChangeNotify,
|
||||
COMRECV_NOTIFY _cbkComRecv,
|
||||
PROXY_NOTIFY _cbkProxyNotify);
|
||||
|
||||
int NetClient_SetPort(int _iServerPort, int _iClientPort);
|
||||
|
||||
int NetClient_Startup_V4(int _iServerPort, int _iClientPort, int _iWnd);
|
||||
|
||||
int NetClient_Cleanup();
|
||||
|
||||
int NetClient_Logon(String _cProxy, String _cIP, String _cUserName,
|
||||
String _cPassword, String _pcProID, int _iPort);
|
||||
|
||||
int NetClient_Logoff(int _iLogonID);
|
||||
|
||||
int NetClient_StartRecvEx(IntByReference _ulConID, CLIENTINFO _cltInfo,
|
||||
RECVDATA_NOTIFY _cbkDataNotify, Pointer _pUserData);
|
||||
|
||||
int NetClient_StartRecvNetPicStream(int _iLogonID, NetPicPara _ptPara, int _iBufLen, IntByReference _puiRecvID);
|
||||
|
||||
int NetClient_StopRecv(int _ulConID);
|
||||
|
||||
int NetClient_StartCaptureData(int _ulConID);
|
||||
|
||||
int NetClient_StartPlay(int _ulConID, int _hWnd, RECT _rcShow, int _iDecflag);
|
||||
|
||||
int NetClient_StopPlay(int _ulConID);
|
||||
|
||||
int NetClient_StartCaptureFile(int _ulConID, String _cFileName,
|
||||
int _iRecFileType);
|
||||
|
||||
int NetClient_StopCaptureFile(int _ulConID);
|
||||
int NetClient_GetLogonStatus(int _iLogonID);
|
||||
int NetClient_GetDevInfo(int _iLogonID,ENCODERINFO _pEncoderInfo);
|
||||
int NetClient_Query_V4(int _iLogonID, int _iCmd, int _iChannel, Pointer _pvCmdBuf, int _iBufLen);
|
||||
int NetClient_NetFileGetFileCount(int _iLogonID, IntByReference _piTotalCount, IntByReference _piCurrentCount);
|
||||
int NetClient_NetFileGetQueryfileEx(int _iLogonID,int _iFileIndex, NVS_FILE_DATA_EX _pFileInfo);
|
||||
int NetClient_NetFileDownload(IntByReference _uiConID, int _iLogonID, int _iCmd, Pointer _pvBuf, int _iBufSize);
|
||||
int NetClient_NetFileStopDownloadFile(int _uiConID);
|
||||
int NetClient_NetFileGetDownloadPos(int _uiConID, IntByReference _piPos, IntByReference _piDLSize);
|
||||
int NetClient_SetRawFrameCallBack(int _uiConID, RAWFRAME_NOTIFY _cbkGetFrame, Pointer _pContext);
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.whdc.playback;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class NetClient {
|
||||
|
||||
private static NVSSDK nvssdk = (NVSSDK)(System.getProperty("os.name").toLowerCase().startsWith("win")?Native.loadLibrary("NVSSDK.dll",NVSSDK.class):Native.loadLibrary("libnvssdk.so",NVSSDK.class));
|
||||
|
||||
public static int GetVersion(NVSSDK.SDK_VERSION _ver) {
|
||||
return nvssdk.NetClient_GetVersion(_ver);
|
||||
}
|
||||
|
||||
public static int SetNotifyFunction(NVSSDK.MAIN_NOTIFY _cbkMainNotify,
|
||||
NVSSDK.ALARM_NOTIFY _cbkAlarmNotify, NVSSDK.PARACHANGE_NOTIFY _cbkParaChangeNotify) {
|
||||
return nvssdk.NetClient_SetNotifyFunction_V4(_cbkMainNotify, _cbkAlarmNotify, _cbkParaChangeNotify, null, null);
|
||||
}
|
||||
|
||||
public static int SetPort(int _iServerPort, int _iClientPort) {
|
||||
return nvssdk.NetClient_SetPort(_iServerPort, _iClientPort);
|
||||
}
|
||||
|
||||
public static int Startup() {
|
||||
return nvssdk.NetClient_Startup_V4(0, 0, 0);
|
||||
}
|
||||
|
||||
public static int Cleanup() {
|
||||
return nvssdk.NetClient_Cleanup();
|
||||
}
|
||||
|
||||
public static int Logon(String _cProxy, String _cIP, String _cUserName,
|
||||
String _cPassword, String _pcProID, int _iPort) {
|
||||
return nvssdk.NetClient_Logon(_cProxy, _cIP, _cUserName,
|
||||
_cPassword, _pcProID, _iPort);
|
||||
}
|
||||
|
||||
public static int Logoff(int _iLogonID) {
|
||||
return nvssdk.NetClient_Logoff(_iLogonID);
|
||||
}
|
||||
|
||||
public static int StartRecv(IntByReference _ulConID, NVSSDK.CLIENTINFO _cltInfo,
|
||||
NVSSDK.RECVDATA_NOTIFY _cbkDataNotify) {
|
||||
return nvssdk.NetClient_StartRecvEx(_ulConID, _cltInfo,
|
||||
_cbkDataNotify, Pointer.NULL);
|
||||
}
|
||||
|
||||
public static int StopRecv(int _ulConID) {
|
||||
return nvssdk.NetClient_StopRecv(_ulConID);
|
||||
}
|
||||
|
||||
public static int StartCaptureData(int _ulConID) {
|
||||
return nvssdk.NetClient_StartCaptureData(_ulConID);
|
||||
}
|
||||
|
||||
public static int StartPlay(int _ulConID, Component _hWnd, int _iDecflag) {
|
||||
int hWnd = (int) Native.getComponentID(_hWnd);
|
||||
NVSSDK.RECT rcShow = new NVSSDK.RECT();
|
||||
return nvssdk.NetClient_StartPlay(_ulConID, hWnd, rcShow,
|
||||
_iDecflag);
|
||||
}
|
||||
|
||||
public static int StopPlay(int _ulConID) {
|
||||
return nvssdk.NetClient_StopPlay(_ulConID);
|
||||
}
|
||||
|
||||
public static int StartCaptureFile(int _ulConID, String _cFileName,
|
||||
int _iRecFileType) {
|
||||
return nvssdk.NetClient_StartCaptureFile(_ulConID,
|
||||
_cFileName, _iRecFileType);
|
||||
}
|
||||
|
||||
public static int StopCaptureFile(int _ulConID) {
|
||||
return nvssdk.NetClient_StopCaptureFile(_ulConID);
|
||||
}
|
||||
|
||||
public static int StartRecvNetPicStream(int _iLogonID, NVSSDK.NetPicPara _ptPara, int _iBufLen, IntByReference _puiRecvID) {
|
||||
return nvssdk.NetClient_StartRecvNetPicStream(_iLogonID, _ptPara, _iBufLen, _puiRecvID);
|
||||
}
|
||||
|
||||
public static int GetLogonStatus(int _iLogonID) {
|
||||
return nvssdk.NetClient_GetLogonStatus(_iLogonID);
|
||||
}
|
||||
|
||||
public static int GetDevInfo(int _iLogonID , NVSSDK.ENCODERINFO _pEncoderInfo) {
|
||||
return nvssdk.NetClient_GetDevInfo(_iLogonID, _pEncoderInfo);
|
||||
}
|
||||
|
||||
public static int Query_V4(int _iLogonID, int _iCmd, int _iChannel, Pointer _pvCmdBuf, int _iBufLen) {
|
||||
return nvssdk.NetClient_Query_V4(_iLogonID, _iCmd, _iChannel, _pvCmdBuf, _iBufLen);
|
||||
}
|
||||
|
||||
public static int NetFileGetFileCount(int _iLogonID, IntByReference _piTotalCount, IntByReference _piCurrentCount) {
|
||||
return nvssdk.NetClient_NetFileGetFileCount(_iLogonID, _piTotalCount, _piCurrentCount);
|
||||
}
|
||||
|
||||
public static int NetFileGetQueryfileEx(int _iLogonID, int _iFileIndex, NVSSDK.NVS_FILE_DATA_EX _pFileInfo) {
|
||||
return nvssdk.NetClient_NetFileGetQueryfileEx(_iLogonID, _iFileIndex, _pFileInfo);
|
||||
}
|
||||
|
||||
public static int NetFileDownload(IntByReference _uiConID, int _iLogonID, int _iCmd, Pointer _pvBuf, int _iBufSize) {
|
||||
return nvssdk.NetClient_NetFileDownload(_uiConID, _iLogonID, _iCmd, _pvBuf, _iBufSize);
|
||||
}
|
||||
|
||||
public static int NetFileStopDownloadFile(int _uiConID) {
|
||||
return nvssdk.NetClient_NetFileStopDownloadFile(_uiConID);
|
||||
}
|
||||
|
||||
public static int SetRawFrameCallBack(int _uiConID, NVSSDK.RAWFRAME_NOTIFY _cbkGetFrame, Pointer _pContext) {
|
||||
return nvssdk.NetClient_SetRawFrameCallBack(_uiConID, _cbkGetFrame, _pContext);
|
||||
}
|
||||
|
||||
public static int NetFileGetDownloadPos(int _uiConID, IntByReference _piPos, IntByReference _piDLSize) {
|
||||
return nvssdk.NetClient_NetFileGetDownloadPos(_uiConID, _piPos, _piDLSize);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,527 @@
|
|||
package com.whdc.playback;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Scanner;
|
||||
|
||||
|
||||
public class Playback {
|
||||
|
||||
int m_iLogonID = -1;
|
||||
int m_iConnectID = -1;
|
||||
int m_iTotalCount = 0;
|
||||
int m_iCurrentCount = 0;
|
||||
String[] suffix = {".sdv", ".ps", "", ".ps", ".mp4", ".avi", ".ts"};
|
||||
|
||||
NVSSDK.MAIN_NOTIFY cbkMain = new NVSSDK.MAIN_NOTIFY() {
|
||||
public void MainNotify(int iLogonID, int wParam, Pointer lParam, Pointer noitfyUserData) {
|
||||
int iMsgType = wParam & 0xFFFF;
|
||||
switch (iMsgType) {
|
||||
case NVSSDK.WCM_LOGON_NOTIFY: {
|
||||
try {
|
||||
int iLogonStatus = NetClient.GetLogonStatus(iLogonID);
|
||||
NVSSDK.ENCODERINFO tDevInfo = new NVSSDK.ENCODERINFO();
|
||||
NetClient.GetDevInfo(iLogonID, tDevInfo);
|
||||
|
||||
String strIP = new String(tDevInfo.m_cEncoder).trim();
|
||||
String strID = new String(tDevInfo.m_cFactoryID).trim();
|
||||
LogonNotify(strIP, strID, iLogonID, iLogonStatus);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
} case NVSSDK.WCM_QUERYFILE_FINISHED: {
|
||||
try {
|
||||
IntByReference iTotalCount = new IntByReference();
|
||||
IntByReference iCurrentCount = new IntByReference();
|
||||
int iRet = NetClient.NetFileGetFileCount(m_iLogonID, iTotalCount, iCurrentCount);
|
||||
if(0 == iRet) {
|
||||
m_iTotalCount = iTotalCount.getValue();
|
||||
m_iCurrentCount = iCurrentCount.getValue();
|
||||
System.out.println("MainNotify:WCM_QUERYFILE_FINISHED! m_iTotalCount= "
|
||||
+ m_iTotalCount + ", m_iCurrentCount=" + m_iCurrentCount);
|
||||
} else {
|
||||
System.out.println("NetFileGetFileCount fail!iRet= " + iRet) ;
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
} case NVSSDK.WCM_DWONLOAD_FINISHED: {
|
||||
System.out.println("MainNotify:WCM_DWONLOAD_FINISHED!download successful!");
|
||||
if(null == lParam)
|
||||
{
|
||||
m_iConnectID = 0;
|
||||
}
|
||||
else {
|
||||
m_iConnectID = (int) Pointer.nativeValue(lParam);
|
||||
}
|
||||
NetClient.NetFileStopDownloadFile(m_iConnectID);
|
||||
break;
|
||||
} case NVSSDK.WCM_DWONLOAD_FAULT: {
|
||||
System.out.println("MainNotify:WCM_DWONLOAD_FAULT!download failed!");
|
||||
if(null == lParam)
|
||||
{
|
||||
m_iConnectID = 0;
|
||||
}
|
||||
else {
|
||||
m_iConnectID = (int) Pointer.nativeValue(lParam);
|
||||
}
|
||||
NetClient.NetFileStopDownloadFile(m_iConnectID);
|
||||
break;
|
||||
} case NVSSDK.WCM_DOWNLOAD_INTERRUPT: {
|
||||
System.out.println("MainNotify:WCM_DOWNLOAD_INTERRUPT!Download interrupted!");
|
||||
if(null == lParam)
|
||||
{
|
||||
m_iConnectID = 0;
|
||||
}
|
||||
else {
|
||||
m_iConnectID = (int) Pointer.nativeValue(lParam);
|
||||
}
|
||||
NetClient.NetFileStopDownloadFile(m_iConnectID);
|
||||
break;
|
||||
} default: break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void LogonNotify(String strIP, String strID, int iLogonID, int iLogonState) {
|
||||
String strMsg = new String();
|
||||
m_iLogonID = -1;
|
||||
switch (iLogonState) {
|
||||
case NVSSDK.LOGON_SUCCESS: {
|
||||
m_iLogonID = iLogonID;
|
||||
strMsg = "LOGON_SUCCESS";
|
||||
break;
|
||||
} case NVSSDK.LOGON_FAILED: {
|
||||
strMsg = "LOGON_FAILED";
|
||||
break;
|
||||
} case NVSSDK.LOGON_TIMEOUT: {
|
||||
strMsg = "LOGON_TIMEOUT";
|
||||
break;
|
||||
} case NVSSDK.LOGON_RETRY: {
|
||||
strMsg = "LOGON_RETRY";
|
||||
break;
|
||||
} case NVSSDK.LOGON_ING: {
|
||||
strMsg = "LOGON_ING";
|
||||
break;
|
||||
} default: {
|
||||
System.out.println("[WCM_LOGON_NOTIFY][" + iLogonState + "] IP("
|
||||
+ strIP + "),ID(" + strID + "),LogonID(" + iLogonID + ")");
|
||||
break;
|
||||
}
|
||||
}
|
||||
System.out.println("[WCM_LOGON_NOTIFY][" + strMsg + "] IP(" + strIP
|
||||
+ "),ID(" + strID + "),LogonID(" + iLogonID + ")");
|
||||
};
|
||||
|
||||
NVSSDK.ALARM_NOTIFY cbkAlarm = new NVSSDK.ALARM_NOTIFY() {
|
||||
public void AlarmNotify(int _iLogonID, int _iChannel,
|
||||
int _iAlarmState, int _iAlarmType, Pointer _pUserData) {
|
||||
}
|
||||
};
|
||||
|
||||
NVSSDK.PARACHANGE_NOTIFY cbkParaChange = new NVSSDK.PARACHANGE_NOTIFY() {
|
||||
public void ParaChangeNotify(int iLogonID, int iChannel, int paraType,
|
||||
Pointer para, Pointer noitfyUserData) {
|
||||
}
|
||||
};
|
||||
|
||||
NVSSDK.RECVDATA_NOTIFY cbkRecvData = new NVSSDK.RECVDATA_NOTIFY() {
|
||||
public void RecvDataNotify(int _ulID, Pointer data, int len, int _iFlag,
|
||||
Pointer _lpUserData) {
|
||||
System.out.println("[RECVDATA_NOTIFY] ConnID(" + _ulID + "),DataLen("
|
||||
+ len + ")");
|
||||
}
|
||||
};
|
||||
|
||||
public void showQueryFileInfo() {
|
||||
int iRet = -1;
|
||||
NVSSDK.NVS_FILE_DATA_EX fileInfo = new NVSSDK.NVS_FILE_DATA_EX();
|
||||
fileInfo.iSize = fileInfo.size();
|
||||
for(int i=0; i < m_iCurrentCount; i++)
|
||||
{
|
||||
iRet = NetClient.NetFileGetQueryfileEx(m_iLogonID, i, fileInfo);
|
||||
if(0 == iRet)
|
||||
{
|
||||
String strFileName = new String(fileInfo.tFileData.cFileName).trim();
|
||||
|
||||
int iStartYear = fileInfo.tFileData.tStartTime.iYear;
|
||||
int iStartMonth = fileInfo.tFileData.tStartTime.iMonth;
|
||||
int iStartDay = fileInfo.tFileData.tStartTime.iDay;
|
||||
int iStartHour = fileInfo.tFileData.tStartTime.iHour;
|
||||
int iStartMinute = fileInfo.tFileData.tStartTime.iMinute;
|
||||
int iStartSecond = fileInfo.tFileData.tStartTime.iSecond;
|
||||
|
||||
int iStopYear = fileInfo.tFileData.tStopTime.iYear;
|
||||
int iStopMonth = fileInfo.tFileData.tStopTime.iMonth;
|
||||
int iStopDay = fileInfo.tFileData.tStopTime.iDay;
|
||||
int iStopHour = fileInfo.tFileData.tStopTime.iHour;
|
||||
int iStopMinute = fileInfo.tFileData.tStopTime.iMinute;
|
||||
int iStopSecond = fileInfo.tFileData.tStopTime.iSecond;
|
||||
|
||||
System.out.println("fileIdx=" + i + ", fileName=" + strFileName
|
||||
+ ", chNo=" + fileInfo.tFileData.iChannel + ", fileSize=" + fileInfo.tFileData.iFileSize
|
||||
+ ", fileStartTime=" + iStartYear + "-" + iStartMonth + "-" + iStartDay + "-"
|
||||
+ iStartHour + "-" + iStartMinute + "-" + iStartSecond
|
||||
+ ", fileStopTime=" + iStopYear + "-" + iStopMonth + "-" + iStopDay + "-"
|
||||
+ iStopHour + "-" + iStopMinute + "-" + iStopSecond);
|
||||
} else {
|
||||
System.out.println("NetFileGetQueryfileEx fail! iRet=" + iRet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int SDKInit() {
|
||||
NVSSDK.SDK_VERSION ver = new NVSSDK.SDK_VERSION();
|
||||
int iRet = NetClient.GetVersion(ver);
|
||||
System.out.println("[SDK_VERSION]" + ver.m_cVerInfo);
|
||||
|
||||
iRet = NetClient.SetNotifyFunction(cbkMain, cbkAlarm, cbkParaChange);
|
||||
System.out.println("SetNotifyFunction(" + iRet + ")");
|
||||
|
||||
iRet = NetClient.Startup();
|
||||
System.out.println("Startup(" + iRet + ")");
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
public int LogonDevice(String strIP, int iPort, String strUserName, String strUserPwd)
|
||||
{
|
||||
System.out.println("Logon" + strIP + ":" + iPort + "-" +strUserName + "-" + strUserPwd);
|
||||
while(true){
|
||||
m_iLogonID = NetClient.Logon("", strIP, strUserName, strUserPwd, "",iPort);
|
||||
int iLogonStatus = NetClient.GetLogonStatus(m_iLogonID);
|
||||
if(iLogonStatus == NVSSDK.LOGON_SUCCESS){
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.currentThread();
|
||||
Thread.sleep(1000);
|
||||
} catch(InterruptedException e) {
|
||||
System.err.println("Interrupted");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
public int SaveRawData(int type, Pointer data, int len)
|
||||
{
|
||||
FileOutputStream fopRawVideo = null;
|
||||
File fileRawVideo;
|
||||
FileOutputStream fopRawAudio = null;
|
||||
File fileRawAudio;
|
||||
try
|
||||
{
|
||||
if (null == fopRawVideo)
|
||||
{
|
||||
fileRawVideo = new File("myVideoRawData.raw");
|
||||
fopRawVideo = new FileOutputStream(fileRawVideo, true);
|
||||
|
||||
// if file doesnt exists, then create it
|
||||
if (!fileRawVideo.exists())
|
||||
{
|
||||
fileRawVideo.createNewFile();
|
||||
}
|
||||
}
|
||||
|
||||
if (null == fopRawAudio)
|
||||
{
|
||||
fileRawAudio = new File("myAudioRawData.raw");
|
||||
fopRawAudio = new FileOutputStream(fileRawAudio, true);
|
||||
|
||||
// if file doesnt exists, then create it
|
||||
if (!fileRawAudio.exists())
|
||||
{
|
||||
fileRawAudio.createNewFile();
|
||||
}
|
||||
}
|
||||
|
||||
// get the content in bytes
|
||||
byte[] contentInBytes = data.getByteArray(0, len);
|
||||
if(NVSSDK.AUDIO_FRAME == type) {
|
||||
//Save raw streaming audio data
|
||||
fopRawAudio.write(contentInBytes);
|
||||
fopRawAudio.flush();
|
||||
fopRawAudio.close();
|
||||
} else {
|
||||
//Save raw streaming video data
|
||||
fopRawVideo.write(contentInBytes);
|
||||
fopRawVideo.flush();
|
||||
fopRawVideo.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
try {
|
||||
if (null != fopRawVideo) {
|
||||
fopRawVideo.close();
|
||||
fopRawVideo = null;
|
||||
}
|
||||
if (null != fopRawAudio) {
|
||||
fopRawAudio.close();
|
||||
fopRawAudio = null;
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
NVSSDK.RAWFRAME_NOTIFY cbkRawFrame = new NVSSDK.RAWFRAME_NOTIFY() {
|
||||
public void rawFrameNotify(int _uiID, Pointer _pcData, int _iLen, NVSSDK.RAWFRAME_INFO _ptRawFrameInfo, Pointer _lpUserData) {
|
||||
//print data information
|
||||
System.out.println("recvRawData: _uiID=" + _uiID + ", _iLen=" + _iLen + ", nType=" + _ptRawFrameInfo.nType);
|
||||
|
||||
//The upper layer can save and process bare stream data
|
||||
if (null != _pcData && 0 != _iLen) {
|
||||
SaveRawData(_ptRawFrameInfo.nType, _pcData, _iLen);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public int PlaybackByFileMode()
|
||||
{
|
||||
Scanner scanInput = new Scanner(System.in);
|
||||
//Inquire
|
||||
NVSSDK.NETFILE_QUERY_V5 tMultiChanQueryFile = new NVSSDK.NETFILE_QUERY_V5();
|
||||
tMultiChanQueryFile.iBufSize = tMultiChanQueryFile.size();
|
||||
tMultiChanQueryFile.iQueryChannelNo = 0; //query channel no, 0x7FFFFFFF means query all channel
|
||||
tMultiChanQueryFile.iStreamNo = 0; //Query stream number, 0-main stream, 1-sub stream
|
||||
tMultiChanQueryFile.iType = 0xFF;
|
||||
|
||||
//current time
|
||||
Calendar cas = Calendar.getInstance();
|
||||
int year = cas.get(Calendar.YEAR);//Get the year
|
||||
int month=cas.get(Calendar.MONTH)+1;//Get the month
|
||||
int day=cas.get(Calendar.DATE);//Get the day
|
||||
int hour=cas.get(Calendar.HOUR_OF_DAY);//hour
|
||||
int minute=cas.get(Calendar.MINUTE);//minute
|
||||
int second=cas.get(Calendar.SECOND);//second
|
||||
|
||||
// query start time
|
||||
tMultiChanQueryFile.tStartTime.iYear = (short)year;
|
||||
tMultiChanQueryFile.tStartTime.iMonth = (short)month;
|
||||
tMultiChanQueryFile.tStartTime.iDay = (short)day;
|
||||
tMultiChanQueryFile.tStartTime.iHour = 0;
|
||||
tMultiChanQueryFile.tStartTime.iMinute = 0;
|
||||
tMultiChanQueryFile.tStartTime.iSecond = 0;
|
||||
// query end time
|
||||
tMultiChanQueryFile.tStopTime.iYear = (short)year;
|
||||
tMultiChanQueryFile.tStopTime.iMonth = (short)month;
|
||||
tMultiChanQueryFile.tStopTime.iDay = (short)day;
|
||||
tMultiChanQueryFile.tStopTime.iHour = (short)hour;
|
||||
tMultiChanQueryFile.tStopTime.iMinute = (short)minute;
|
||||
tMultiChanQueryFile.tStopTime.iSecond = (short)second;
|
||||
|
||||
tMultiChanQueryFile.iPageSize = 20; //The page size of each query, that is, the number of records per query
|
||||
tMultiChanQueryFile.iPageNo = 0; //Query page number, for example, there are 100 records in total, and the page size of each query is 20, then the page number is 0, 1, 2, 3, 4
|
||||
tMultiChanQueryFile.iFiletype = 1; //File type 0:all,1:Video,2:picture
|
||||
tMultiChanQueryFile.iTriggerType = 0x7FFFFFFF;
|
||||
tMultiChanQueryFile.iTrigger = 0;
|
||||
tMultiChanQueryFile.iQueryChannelCount = 1; //Number of channels for this query, some nvr supports batch query use, the default single channel query can be used
|
||||
NVSSDK.ArrayQueryFileChannel arrayQueryFileChannel = new NVSSDK.ArrayQueryFileChannel(); //Batch query channel array, default query by single channel
|
||||
NVSSDK.QueryFileChannel tQueryFileChannel0 = new NVSSDK.QueryFileChannel();
|
||||
NVSSDK.QueryFileChannel tQueryFileChannel1 = new NVSSDK.QueryFileChannel();
|
||||
tQueryFileChannel0.iChannelNo = 0;
|
||||
tQueryFileChannel0.iStreamNo = 0;
|
||||
tQueryFileChannel1.iChannelNo = 0;
|
||||
tQueryFileChannel1.iStreamNo = 1;
|
||||
arrayQueryFileChannel.tArry[0] = tQueryFileChannel0;
|
||||
arrayQueryFileChannel.tArry[1] = tQueryFileChannel1;
|
||||
tMultiChanQueryFile.ptChannelList = arrayQueryFileChannel.getPointer();
|
||||
tMultiChanQueryFile.iBufferSize = tQueryFileChannel0.size(); //Query structure size
|
||||
tMultiChanQueryFile.write();
|
||||
int iRet = NetClient.Query_V4(m_iLogonID, NVSSDK.CMD_NETFILE_MULTI_CHANNEL_QUERY_FILE, 0, tMultiChanQueryFile.getPointer(), tMultiChanQueryFile.size());
|
||||
if (0 == iRet) {
|
||||
System.out.println("Query_V4:CMD_NETFILE_MULTI_CHANNEL_QUERY_FILE succ! iRet=" + iRet);
|
||||
} else {
|
||||
System.err.println("Query_V4:CMD_NETFILE_MULTI_CHANNEL_QUERY_FILE fail! iRet=" + iRet);
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Wait for query result
|
||||
while(0 == m_iCurrentCount) {
|
||||
try {
|
||||
Thread.currentThread();
|
||||
Thread.sleep(1000);
|
||||
} catch(InterruptedException e) {
|
||||
System.err.println("Interrupted");
|
||||
}
|
||||
}
|
||||
|
||||
//Display query file information
|
||||
showQueryFileInfo();
|
||||
|
||||
//download
|
||||
NVSSDK.DOWNLOAD_FILE tFileInfo = new NVSSDK.DOWNLOAD_FILE();
|
||||
tFileInfo.m_iSize = tFileInfo.size();
|
||||
System.out.print("Please enter the video file type (sdv=0;PS=3;MP4=4;AVI=5;TS=6): ");
|
||||
int iSaveFileType = scanInput.nextInt();
|
||||
tFileInfo.m_iSaveFileType = iSaveFileType;
|
||||
System.out.print("Please enter the file name to download: ");
|
||||
String strDownloadFileName = scanInput.next();
|
||||
tFileInfo.m_cRemoteFilename = strDownloadFileName.getBytes(); //The name of the video to be downloaded, which is the name of the video queried from the device
|
||||
String strLocalFileName = strDownloadFileName.substring(0, strDownloadFileName.lastIndexOf(".")) + suffix[iSaveFileType];
|
||||
tFileInfo.m_cLocalFilename = strLocalFileName.getBytes(); //The name of the video to be saved in the local download, the default is the same as the name of the queried device video
|
||||
tFileInfo.m_iPosition = -1; //Use the positioning function
|
||||
tFileInfo.m_iSpeed = 32; //Download speed, the maximum is 32, the old device is prone to interruptions when downloading at the maximum speed, so after the download is successful, the speed can be adjusted to 16 times the speed
|
||||
tFileInfo.m_iReqMode = 1; //Require data mode 1,Frame mode;0,Stream mode
|
||||
tFileInfo.write();
|
||||
IntByReference iConnID = new IntByReference();
|
||||
iRet = NetClient.NetFileDownload(iConnID, m_iLogonID, NVSSDK.DOWNLOAD_CMD_FILE, tFileInfo.getPointer(), tFileInfo.size());
|
||||
if (0 == iRet) {
|
||||
//Set the naked streaming callback, receive audio and video naked streaming data in the callback
|
||||
m_iConnectID = iConnID.getValue();
|
||||
NetClient.SetRawFrameCallBack(m_iConnectID, cbkRawFrame, null);
|
||||
//Adjust the speed
|
||||
NVSSDK.DOWNLOAD_CONTROL tControl = new NVSSDK.DOWNLOAD_CONTROL();
|
||||
tControl.m_iSize = tControl.size();
|
||||
tControl.m_iPosition = -1;
|
||||
tControl.m_iSpeed = 16;
|
||||
tControl.m_iReqMode = 1;
|
||||
tControl.write();
|
||||
iRet = NetClient.NetFileDownload(iConnID, m_iLogonID, NVSSDK.DOWNLOAD_CMD_CONTROL, tControl.getPointer(), tControl.size());
|
||||
} else {
|
||||
System.err.println("NetFileDownload:DOWNLOAD_CMD_FILE fail! iRet=" + iRet);
|
||||
}
|
||||
|
||||
// Get download progress regularly
|
||||
int iPregress = 0; // download progress
|
||||
int iDownLoadSize = 0; // download file size
|
||||
while(100 != iPregress) {
|
||||
try {
|
||||
Thread.currentThread();
|
||||
IntByReference piPos = new IntByReference();
|
||||
IntByReference piDLSize = new IntByReference();
|
||||
iRet = NetClient.NetFileGetDownloadPos(m_iConnectID, piPos, piDLSize);
|
||||
iPregress = piPos.getValue();
|
||||
iDownLoadSize = piDLSize.getValue();
|
||||
System.out.println("Pregress=" + iPregress + ", DownloadSize=" + iDownLoadSize);
|
||||
Thread.sleep(1000);
|
||||
} catch(InterruptedException e) {
|
||||
System.err.println("Interrupted");
|
||||
}
|
||||
}
|
||||
|
||||
iRet = NetClient.NetFileStopDownloadFile(m_iConnectID);
|
||||
|
||||
return iRet;
|
||||
};
|
||||
|
||||
public int PlaybackByTimespanMode()
|
||||
{
|
||||
NVSSDK.DOWNLOAD_TIMESPAN tDownloadTimeSpan = new NVSSDK.DOWNLOAD_TIMESPAN();
|
||||
tDownloadTimeSpan.m_iSize = tDownloadTimeSpan.size();
|
||||
Scanner scanInput = new Scanner(System.in);
|
||||
System.out.print("Please enter the video file type (sdv=0;PS=3;MP4=4;AVI=5;TS=6): ");
|
||||
int iSaveFileType = scanInput.nextInt();
|
||||
tDownloadTimeSpan.m_iSaveFileType = iSaveFileType;
|
||||
tDownloadTimeSpan.m_iFileFlag = 0; //0:Download multiple files 1:Download into a single file
|
||||
|
||||
String strLocalSaveFileName = new String("myTimespanDownload"+suffix[iSaveFileType]);
|
||||
tDownloadTimeSpan.m_cLocalFilename = strLocalSaveFileName.getBytes();
|
||||
tDownloadTimeSpan.m_iChannelNO = 0; //The channel number is assigned according to the actual downloaded device channel number
|
||||
tDownloadTimeSpan.m_iStreamNo = 0; //Stream number: 0-main stream, 1-secondary stream
|
||||
|
||||
//current time
|
||||
Calendar cas = Calendar.getInstance();
|
||||
int year = cas.get(Calendar.YEAR);//Get the year
|
||||
int month=cas.get(Calendar.MONTH)+1;//Get the month
|
||||
int day=cas.get(Calendar.DATE);//Get the day
|
||||
int hour=cas.get(Calendar.HOUR_OF_DAY);//hour
|
||||
int minute=cas.get(Calendar.MINUTE);//minute
|
||||
int second=cas.get(Calendar.SECOND);//second
|
||||
|
||||
//Download start time by time period
|
||||
tDownloadTimeSpan.m_tTimeBegin.iYear = (short)year;
|
||||
tDownloadTimeSpan.m_tTimeBegin.iMonth = (short)month;
|
||||
tDownloadTimeSpan.m_tTimeBegin.iDay = (short)day;
|
||||
tDownloadTimeSpan.m_tTimeBegin.iHour = 0;
|
||||
tDownloadTimeSpan.m_tTimeBegin.iMinute = 0;
|
||||
tDownloadTimeSpan.m_tTimeBegin.iSecond = 0;
|
||||
//Download end time by time period
|
||||
tDownloadTimeSpan.m_tTimeEnd.iYear = (short)year;
|
||||
tDownloadTimeSpan.m_tTimeEnd.iMonth = (short)month;
|
||||
tDownloadTimeSpan.m_tTimeEnd.iDay = (short)day;
|
||||
tDownloadTimeSpan.m_tTimeEnd.iHour = (short)hour;
|
||||
tDownloadTimeSpan.m_tTimeEnd.iMinute = (short)minute;
|
||||
tDownloadTimeSpan.m_tTimeEnd.iSecond = (short)second;
|
||||
|
||||
tDownloadTimeSpan.m_iPosition = -1; //Use the positioning function
|
||||
tDownloadTimeSpan.m_iSpeed = 32; //Download speed, maximum 32, old devices are prone to interruptions when downloading at the maximum speed, so after the download is successful, the speed can be adjusted to 16 times the speed
|
||||
tDownloadTimeSpan.m_iReqMode = 1; //1:down frame mode,0= Flow pattern; if (mode == 0) Device do not send download time !
|
||||
tDownloadTimeSpan.write();
|
||||
IntByReference iConnID = new IntByReference();
|
||||
int iRet = NetClient.NetFileDownload(iConnID, m_iLogonID, NVSSDK.DOWNLOAD_CMD_TIMESPAN, tDownloadTimeSpan.getPointer(), tDownloadTimeSpan.size());
|
||||
if (0 == iRet)
|
||||
{
|
||||
//Set the naked streaming callback, receive audio and video naked streaming data in the callback
|
||||
m_iConnectID = iConnID.getValue();
|
||||
NetClient.SetRawFrameCallBack(m_iConnectID, cbkRawFrame, null);
|
||||
//Adjust the speed
|
||||
NVSSDK.DOWNLOAD_CONTROL tControl = new NVSSDK.DOWNLOAD_CONTROL();
|
||||
tControl.m_iSize = tControl.size();
|
||||
tControl.m_iPosition = -1;
|
||||
tControl.m_iSpeed = 16;
|
||||
tControl.m_iReqMode = 1;
|
||||
tControl.write();
|
||||
NetClient.NetFileDownload(iConnID, m_iLogonID, NVSSDK.DOWNLOAD_CMD_CONTROL, tControl.getPointer(), tControl.size());
|
||||
} else {
|
||||
System.err.println("NetFileDownload:DOWNLOAD_CMD_TIMESPAN fail! iRet=" + iRet);
|
||||
}
|
||||
|
||||
return iRet;
|
||||
};
|
||||
|
||||
public static void main(String args[])
|
||||
{
|
||||
System.out.println("PlaybackDemo!");
|
||||
Playback tPlayback = new Playback();
|
||||
tPlayback.SDKInit(); //Initialize SDK
|
||||
|
||||
Scanner scanInput = new Scanner(System.in);
|
||||
System.out.print("Please enter the device IP: ");
|
||||
String strDevIP = scanInput.next();
|
||||
System.out.print("Please enter the device port: ");
|
||||
int iDevPort = scanInput.nextInt();
|
||||
System.out.print("Please enter username: ");
|
||||
String strUserName = scanInput.next();
|
||||
System.out.print("Please enter password: ");
|
||||
String strUserPwd = scanInput.next();
|
||||
tPlayback.LogonDevice(strDevIP, iDevPort, strUserName, strUserPwd);//Logon the device
|
||||
|
||||
System.out.print("Please enter the mode (0-file mode, 1-time period mode): ");
|
||||
int modePlayback = scanInput.nextInt();
|
||||
if (0 == modePlayback) {
|
||||
tPlayback.PlaybackByFileMode();
|
||||
} else {
|
||||
tPlayback.PlaybackByTimespanMode();
|
||||
}
|
||||
|
||||
while(true){
|
||||
try {
|
||||
Thread.currentThread();
|
||||
Thread.sleep(1000);
|
||||
} catch(InterruptedException e) {
|
||||
System.err.println("Interrupted");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.whdc.service;
|
||||
|
||||
public interface IDeviceManager {
|
||||
void initSDK();
|
||||
boolean login(String ip, int port, String username, String password);
|
||||
void logout();
|
||||
boolean isLoggedIn();
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package com.whdc.service;
|
||||
|
||||
public interface IPTZControl {
|
||||
boolean controlDirection(int channelNo, int direction, int speed);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.whdc.service;
|
||||
|
||||
|
||||
import com.whdc.callback.DecodedDataCallback;
|
||||
import com.whdc.callback.RawFrameCallback;
|
||||
|
||||
public interface IVideoStream {
|
||||
int startRealPlay(int channelNo, int streamType, int netMode,int m_iLogonID);
|
||||
void stopRealPlay(int connectId);
|
||||
void setRawFrameCallback(int connectId, RawFrameCallback callback);
|
||||
void setDecodedDataCallback(int connectId, DecodedDataCallback callback);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class VideoStreamService {
|
||||
|
||||
private byte[] currentFrame;
|
||||
private Long lastFrameTime;
|
||||
|
||||
public void storeFrame(byte[] frameData) {
|
||||
this.currentFrame = frameData;
|
||||
this.lastFrameTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public byte[] getCurrentFrame() {
|
||||
return currentFrame;
|
||||
}
|
||||
|
||||
public boolean isStreamActive() {
|
||||
return lastFrameTime != null &&
|
||||
(System.currentTimeMillis() - lastFrameTime) < 30000;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
this.currentFrame = null;
|
||||
this.lastFrameTime = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,196 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.whdc.callback.DecodedDataCallback;
|
||||
import com.whdc.callback.RawFrameCallback;
|
||||
import com.whdc.dto.FrameInfo;
|
||||
import com.whdc.dto.RawFrameInfo;
|
||||
import com.whdc.service.IDeviceManager;
|
||||
import com.whdc.service.IPTZControl;
|
||||
import com.whdc.service.IVideoStream;
|
||||
import com.whdc.video.NVSSDK1;
|
||||
import com.whdc.video.NetClient1;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Service
|
||||
public class VideoSurveillanceService implements IDeviceManager, IVideoStream, IPTZControl {
|
||||
|
||||
private int m_iLogonID = -1;
|
||||
private Map<Integer, RawFrameCallback> rawFrameCallbacks = new ConcurrentHashMap<>();
|
||||
private Map<Integer, DecodedDataCallback> decodedDataCallbacks = new ConcurrentHashMap<>();
|
||||
|
||||
// 设备管理接口实现
|
||||
@Override
|
||||
public void initSDK() {
|
||||
NVSSDK1.SDK_VERSION ver = new NVSSDK1.SDK_VERSION();
|
||||
NetClient1.GetVersion(ver);
|
||||
System.out.println("[SDK_VERSION]" + ver.m_cVerInfo);
|
||||
|
||||
int iRet = NetClient1.SetNotifyFunction(cbkMain, cbkAlarm, cbkParaChange);
|
||||
iRet = NetClient1.Startup();
|
||||
System.out.println("SDK初始化完成");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean login(String ip, int port, String username, String password) {
|
||||
NVSSDK1.LogonPara tLogonPara = new NVSSDK1.LogonPara();
|
||||
tLogonPara.iSize = tLogonPara.size();
|
||||
tLogonPara.cNvsIP = ip.getBytes();
|
||||
tLogonPara.iNvsPort = port;
|
||||
tLogonPara.cUserName = username.getBytes();
|
||||
tLogonPara.cUserPwd = password.getBytes();
|
||||
tLogonPara.write();
|
||||
|
||||
m_iLogonID = NetClient1.Logon_V4(NVSSDK1.SERVER_NORMAL, tLogonPara.getPointer(), tLogonPara.size());
|
||||
return m_iLogonID >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logout() {
|
||||
if (m_iLogonID >= 0) {
|
||||
NetClient1.Logoff(m_iLogonID);
|
||||
m_iLogonID = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggedIn() {
|
||||
return m_iLogonID >= 0;
|
||||
}
|
||||
|
||||
// 视频流接口实现
|
||||
@Override
|
||||
public int startRealPlay(int channelNo, int streamType, int netMode,int m_iLogonID) {
|
||||
NVSSDK1.CLIENTINFO clientInfo = new NVSSDK1.CLIENTINFO();
|
||||
clientInfo.m_iChannelNo = channelNo;
|
||||
clientInfo.m_iNetMode = netMode;
|
||||
clientInfo.m_iStreamNO = streamType;
|
||||
clientInfo.m_iServerID = m_iLogonID;
|
||||
clientInfo.m_iBufferCount = 20;
|
||||
clientInfo.write();
|
||||
|
||||
IntByReference piConnectID = new IntByReference();
|
||||
int iRet = NetClient1.StartRecv_V4(piConnectID, clientInfo, cbkNvsData, null);
|
||||
if (iRet < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int connectId = piConnectID.getValue();
|
||||
NetClient1.StartCaptureData(connectId);
|
||||
NetClient1.SetRawFrameCallBack(connectId, cbkRawFrame, null);
|
||||
NetClient1.StartPlay(connectId, null, 0);
|
||||
|
||||
return connectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopRealPlay(int connectId) {
|
||||
if (connectId >= 0) {
|
||||
NetClient1.StopCaptureData(connectId);
|
||||
NetClient1.StopRecv(connectId);
|
||||
rawFrameCallbacks.remove(connectId);
|
||||
decodedDataCallbacks.remove(connectId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRawFrameCallback(int connectId, RawFrameCallback callback) {
|
||||
rawFrameCallbacks.put(connectId, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDecodedDataCallback(int connectId, DecodedDataCallback callback) {
|
||||
decodedDataCallbacks.put(connectId, callback);
|
||||
}
|
||||
|
||||
// 云台控制接口实现
|
||||
@Override
|
||||
public boolean controlDirection(int channelNo, int direction, int speed) {
|
||||
int iRet;
|
||||
if (direction == NVSSDK1.PROTOCOL_MOVE_UP || direction == NVSSDK1.PROTOCOL_MOVE_DOWN) {
|
||||
iRet = NetClient1.DeviceCtrlEx(m_iLogonID, channelNo, direction, 0, speed, 0);
|
||||
} else if (direction == NVSSDK1.PROTOCOL_MOVE_LEFT || direction == NVSSDK1.PROTOCOL_MOVE_RIGHT) {
|
||||
iRet = NetClient1.DeviceCtrlEx(m_iLogonID, channelNo, direction, speed, 0, 0);
|
||||
} else {
|
||||
iRet = NetClient1.DeviceCtrlEx(m_iLogonID, channelNo, direction, 0, 0, 0);
|
||||
}
|
||||
return iRet == NVSSDK1.RET_SUCCESS;
|
||||
}
|
||||
|
||||
// 转换方法
|
||||
private RawFrameInfo convertRawFrameInfo(NVSSDK1.RAWFRAME_INFO info) {
|
||||
RawFrameInfo frameInfo = new RawFrameInfo();
|
||||
frameInfo.setWidth(info.nWidth);
|
||||
frameInfo.setHeight(info.nHeight);
|
||||
frameInfo.setTimeStamp(info.nStamp);
|
||||
frameInfo.setFrameType(info.nType);
|
||||
frameInfo.setEncoderType(info.nEnCoder);
|
||||
frameInfo.setFrameRate(info.nFrameRate);
|
||||
frameInfo.setAbsStamp(info.nAbsStamp);
|
||||
frameInfo.setBitsPerSample(info.ucBitsPerSample);
|
||||
frameInfo.setSamplesPerSec(info.uiSamplesPerSec);
|
||||
return frameInfo;
|
||||
}
|
||||
|
||||
private FrameInfo convertFrameInfo(NVSSDK1.FRAME_INFO info) {
|
||||
FrameInfo frameInfo = new FrameInfo();
|
||||
frameInfo.setWidth(info.nWidth);
|
||||
frameInfo.setHeight(info.nHeight);
|
||||
frameInfo.setTimeStamp(info.nStamp);
|
||||
frameInfo.setFrameType(info.nType);
|
||||
frameInfo.setFrameRate(info.nFrameRate);
|
||||
frameInfo.setReserved(info.nReserved);
|
||||
return frameInfo;
|
||||
}
|
||||
|
||||
// 回调函数
|
||||
private NVSSDK1.MAIN_NOTIFY cbkMain = new NVSSDK1.MAIN_NOTIFY() {
|
||||
public void MainNotify(int iLogonID, int wParam, Pointer lParam, Pointer noitfyUserData) {
|
||||
int iMsgType = wParam & 0xFFFF;
|
||||
if (iMsgType == NVSSDK1.WCM_LOGON_NOTIFY) {
|
||||
int iLogonStatus = NetClient1.GetLogonStatus(iLogonID);
|
||||
System.out.println("登录状态通知: " + iLogonStatus);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private NVSSDK1.ALARM_NOTIFY cbkAlarm = new NVSSDK1.ALARM_NOTIFY() {
|
||||
public void AlarmNotify(int _iLogonID, int _iChannel, int _iAlarmState, int _iAlarmType, Pointer _pUserData) {}
|
||||
};
|
||||
|
||||
private NVSSDK1.PARACHANGE_NOTIFY cbkParaChange = new NVSSDK1.PARACHANGE_NOTIFY() {
|
||||
public void ParaChangeNotify(int iLogonID, int iChannel, int paraType, Pointer para, Pointer noitfyUserData) {}
|
||||
};
|
||||
|
||||
private NVSSDK1.NVSDATA_NOTIFY cbkNvsData = new NVSSDK1.NVSDATA_NOTIFY() {
|
||||
public void NvsDataNotify(int _uiID, Pointer _pucData, int _iLen, Pointer _iUser) {}
|
||||
};
|
||||
|
||||
private NVSSDK1.RAWFRAME_NOTIFY cbkRawFrame = new NVSSDK1.RAWFRAME_NOTIFY() {
|
||||
public void rawFrameNotify(int _uiID, Pointer _pcData, int _iLen,
|
||||
NVSSDK1.RAWFRAME_INFO _ptRawFrameInfo, Pointer _lpUserData) {
|
||||
RawFrameCallback callback = rawFrameCallbacks.get(_uiID);
|
||||
if (callback != null && _pcData != null && _iLen != 0) {
|
||||
byte[] data = _pcData.getByteArray(0, _iLen);
|
||||
RawFrameInfo frameInfo = convertRawFrameInfo(_ptRawFrameInfo);
|
||||
callback.onRawFrameReceived(_uiID, data, frameInfo);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private NVSSDK1.DECYUV_NOTIFY_V4 cbkDecYuv = new NVSSDK1.DECYUV_NOTIFY_V4() {
|
||||
public void decYuvNotify(int _uiID, Pointer _pcData, int _iLen,
|
||||
NVSSDK1.FRAME_INFO _pFrameInfo, Pointer _pvUser) {
|
||||
DecodedDataCallback callback = decodedDataCallbacks.get(_uiID);
|
||||
if (callback != null && _pcData != null && _iLen != 0) {
|
||||
byte[] data = _pcData.getByteArray(0, _iLen);
|
||||
FrameInfo frameInfo = convertFrameInfo(_pFrameInfo);
|
||||
callback.onDecodedDataReceived(_uiID, data, frameInfo);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,712 @@
|
|||
package com.whdc.video;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.Structure.ByValue;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
|
||||
import com.sun.jna.Callback;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
public interface NVSSDK1 extends Library {
|
||||
|
||||
public static final int RET_SUCCESS = 0; //success
|
||||
public static final int RET_FAILED = -1; //failed
|
||||
|
||||
public static final int SERVER_NORMAL = 0;
|
||||
public static final int SERVER_ACTIVE = 1;
|
||||
public static final int SERVER_DNS = 2;
|
||||
public static final int SERVER_FIND_PSW = 3;
|
||||
public static final int SERVER_REG_ACTIVE = 4;
|
||||
|
||||
public static final int WM_USER = 0x0400; //
|
||||
|
||||
public static final int WM_MAIN_MESSAGE = WM_USER + 1001; //system message
|
||||
public static final int WM_PARACHG = WM_USER + 1002; //Parameter change message
|
||||
public static final int WM_ALARM = WM_USER + 1003; //Alarm message
|
||||
public static final int WCM_ERR_ORDER = 2;
|
||||
public static final int WCM_ERR_DATANET = 3;
|
||||
public static final int WCM_LOGON_NOTIFY = 7;
|
||||
public static final int WCM_VIDEO_HEAD = 8;
|
||||
public static final int WCM_VIDEO_DISCONNECT = 9;
|
||||
public static final int WCM_RECORD_ERR = 13;
|
||||
public static final int WCM_QUERYFILE_FINISHED = 18;
|
||||
public static final int WCM_DWONLOAD_FINISHED = 19;
|
||||
public static final int WCM_DWONLOAD_FAULT = 20;
|
||||
public static final int WCM_DOWNLOAD_INTERRUPT = 29;
|
||||
|
||||
public static final int LOGON_SUCCESS = 0;
|
||||
public static final int LOGON_ING = 1;
|
||||
public static final int LOGON_RETRY = 2;
|
||||
public static final int LOGON_DSMING = 3;
|
||||
public static final int LOGON_FAILED = 4;
|
||||
public static final int LOGON_TIMEOUT = 5;
|
||||
public static final int NOT_LOGON = 6;
|
||||
public static final int LOGON_DSMFAILED = 7;
|
||||
public static final int LOGON_DSMTIMEOUT = 8;
|
||||
public static final int PLAYER_PLAYING = 0x02;
|
||||
public static final int USER_ERROR = 0x10000000;
|
||||
|
||||
public static final int REC_FILE_TYPE_STOP = -1;
|
||||
public static final int REC_FILE_TYPE_NORMAL = 0;
|
||||
public static final int REC_FILE_TYPE_AVI = 1;
|
||||
public static final int REC_FILE_TYPE_ASF = 2;
|
||||
public static final int REC_FILE_TYPE_AUDIO = 3;
|
||||
public static final int REC_FILE_TYPE_RAWAAC = 4;
|
||||
public static final int REC_FILE_TYPE_VIDEO = 5;
|
||||
public static final int REC_FILE_TYPE_MP4 = 6;
|
||||
public static final int REC_FILE_TYPE_PS = 8;
|
||||
public static final int REC_FILE_TYPE_TS = 9;
|
||||
public static final int REC_FILE_TYPE_ZFMP4 = 10;
|
||||
|
||||
public static final int MOVE_UP = 1;
|
||||
public static final int MOVE_UP_STOP = 2;
|
||||
public static final int MOVE_DOWN = 3;
|
||||
public static final int MOVE_DOWN_STOP = 4;
|
||||
public static final int MOVE_LEFT = 5;
|
||||
public static final int MOVE_LEFT_STOP = 6;
|
||||
public static final int MOVE_RIGHT = 7;
|
||||
public static final int MOVE_RIGHT_STOP = 8;
|
||||
public static final int MOVE_UP_LEFT = 9;
|
||||
public static final int MOVE_UP_LEFT_STOP = 10;
|
||||
public static final int MOVE_UP_RIGHT = 11;
|
||||
public static final int MOVE_UP_RIGHT_STOP = 12;
|
||||
public static final int MOVE_DOWN_LEFT = 13;
|
||||
public static final int MOVE_DOWN_LEFT_STOP = 14;
|
||||
public static final int MOVE_DOWN_RIGHT = 15;
|
||||
public static final int MOVE_DOWN_RIGHT_STOP = 16;
|
||||
|
||||
public static final int HOR_AUTO = 21;
|
||||
public static final int HOR_AUTO_STOP = 22;
|
||||
|
||||
public static final int ZOOM_BIG = 31;
|
||||
public static final int ZOOM_BIG_STOP = 32;
|
||||
public static final int ZOOM_SMALL = 33;
|
||||
public static final int ZOOM_SMALL_STOP = 34;
|
||||
public static final int FOCUS_FAR = 35;
|
||||
public static final int FOCUS_FAR_STOP = 36;
|
||||
public static final int FOCUS_NEAR = 37;
|
||||
public static final int FOCUS_NEAR_STOP = 38;
|
||||
public static final int IRIS_OPEN = 39;
|
||||
public static final int IRIS_OPEN_STOP = 40;
|
||||
public static final int IRIS_CLOSE = 41;
|
||||
public static final int IRIS_CLOSE_STOP = 42;
|
||||
public static final int LIGHT_ON = 43;
|
||||
public static final int LIGHT_OFF = 44;
|
||||
public static final int POWER_ON = 45;
|
||||
public static final int POWER_OFF = 46;
|
||||
public static final int RAIN_ON = 47;
|
||||
public static final int RAIN_OFF = 48;
|
||||
|
||||
public static final int MOVE = 60;
|
||||
public static final int MOVE_STOP = 61;
|
||||
public static final int CALL_VIEW = 62;
|
||||
public static final int SET_VIEW = 63;
|
||||
|
||||
public static final int ALARM_VDO_MOTION = 0;
|
||||
public static final int ALARM_VDO_REC = 1;
|
||||
public static final int ALARM_VDO_LOST = 2;
|
||||
public static final int ALARM_VDO_INPORT = 3;
|
||||
public static final int ALARM_VDO_OUTPORT = 4;
|
||||
public static final int ALARM_VDO_COVER = 5;
|
||||
public static final int ALARM_VCA_INFO = 6; //Intelligent analysis of alarm information
|
||||
|
||||
//decode data type
|
||||
public static final int T_AUDIO8 = 0;
|
||||
public static final int T_YUV420 = 1;
|
||||
public static final int T_YUV422 = 2;
|
||||
|
||||
public static final int NET_PICSTREAM_CMD_VCA = 1; //Callback VCA image stream information
|
||||
public static final int NET_PICSTREAM_CMD_ITS = 2; //Callback ITS image stream information
|
||||
public static final int NET_PICSTREAM_CMD_FACE = 3; //Callback face image stream information
|
||||
public static final int NET_PICSTREAM_CMD_NORMALSNAP = 4; //Callback normal snap image stream information
|
||||
|
||||
//Front end video query
|
||||
public static final int CMD_NETFILE_QUERY_FILE = 0;
|
||||
public static final int CMD_NETFILE_ITS_QUERY_DATA = 1;
|
||||
public static final int CMD_NETFILE_ITS_GETTOTALCOUNT = 2;
|
||||
public static final int CMD_NETFILE_ITS_GETCURRENTCOUNT = 3;
|
||||
public static final int CMD_NETFILE_ITS_GETRESULT = 4;
|
||||
public static final int CMD_NETFILE_ITS_QUERY_TOTALCOUNT = 5;
|
||||
public static final int CMD_NETFILE_MULTI_CHANNEL_QUERY_FILE = 6;
|
||||
public static final int CMD_NETFILE_QUERY_VCA = 7;
|
||||
|
||||
public static final int DOWNLOAD_FLAG_FIRST_REQUEST = 0;
|
||||
public static final int DOWNLOAD_FLAG_OPERATE_RECORD = 1;
|
||||
public static final int DOWNLOAD_FLAG_BREAK_CONTINUE = 2;
|
||||
|
||||
public static final int DOWNLOAD_CMD_FILE = 0;
|
||||
public static final int DOWNLOAD_CMD_TIMESPAN = 1;
|
||||
public static final int DOWNLOAD_CMD_CONTROL = 2;
|
||||
public static final int DOWNLOAD_CMD_FILE_CONTINUE = 3;
|
||||
public static final int DOWNLOAD_CMD_GET_FILE_COUNT = 4;
|
||||
public static final int DOWNLOAD_CMD_GET_FILE_INFO = 5;
|
||||
public static final int DOWNLOAD_CMD_SET_FILE_INFO = 6;
|
||||
|
||||
//download file type
|
||||
public static final int DOWNLOAD_FILE_TYPE_SDV = 0;
|
||||
public static final int DOWNLOAD_FILE_TYPE_PS = 3;
|
||||
|
||||
public static final int VI_FRAME = 0;
|
||||
public static final int VP_FRAME = 1;
|
||||
public static final int AUDIO_FRAME = 5;
|
||||
|
||||
public static final int RAW_VIDEO_H264 = 1;
|
||||
public static final int RAW_VIDEO_MPEG4 = 2;
|
||||
public static final int RAW_VIDEO_MJPEG = 41;
|
||||
public static final int RAW_VIDEO_H265 = 23;
|
||||
|
||||
public static final int RAW_AUDIO_G711_A = 0x01;
|
||||
public static final int RAW_AUDIO_G711_U = 0x02;
|
||||
public static final int RAW_AUDIO_ADPCM_A = 0x03;
|
||||
public static final int RAW_AUDIO_AAC = 0x16;
|
||||
|
||||
public static final int PROTOCOL_MOVE_UP = 1; //move up
|
||||
public static final int PROTOCOL_MOVE_DOWN = 2; //move down
|
||||
public static final int PROTOCOL_MOVE_LEFT = 3; //move left
|
||||
public static final int PROTOCOL_MOVE_RIGHT = 4; //move right
|
||||
public static final int PROTOCOL_MOVE_STOP = 9; //stop move
|
||||
public static final int SET_HOR_AUTO_BEGIN = 23; //set horizontal auto start
|
||||
public static final int SET_HOR_AUTO_END = 24; //set horizontal auto end
|
||||
|
||||
//Capture type
|
||||
public static final int CAPTURE_PICTURE_TYPE_YUV = 0;
|
||||
public static final int CAPTURE_PICTURE_TYPE_BMP = 1;
|
||||
public static final int CAPTURE_PICTURE_TYPE_JPG = 2;
|
||||
public static final int CAPTURE_PICTURE_TYPE_FEC_BMP = 3;
|
||||
public static final int CAPTURE_PICTURE_TYPE_FEC_JPG = 4;
|
||||
|
||||
public static final int NET_CLIENT_GET_FUNC_ABILITY = 99; //get function ability
|
||||
|
||||
public static final int COMMAND_ID_3D_POSITION = 57;
|
||||
|
||||
public static final int MAIN_FUNC_TYPE_DOME_PARA = 0x08; //dome para
|
||||
|
||||
public static final int GENERAL_CMD_GET_CHANNEL_TYPE = 1; //et the property of a channel of this device
|
||||
|
||||
//Get the attribute parameters of the device channel
|
||||
public static final int CHANNEL_TYPE_LOCAL = 0; // local analog channel
|
||||
public static final int CHANNEL_TYPE_DIGITAL = 2; // Digital channel
|
||||
public static final int CHANNEL_TYPE_COMBINE = 3; // Synthesize the channel
|
||||
public static final int CHANNEL_TYPE_FISHEYE = 4; // fish eye channel
|
||||
public static final int CHANNEL_TYPE_FULLVIEW = 9999; // full view channel
|
||||
|
||||
public static final int NET_CLIENT_ELEVATOR_MONITOR = 322; //Set/Get Elevator Monitor
|
||||
public static final int NET_CLIENT_ELEVATOR_STOREYINFO = 323; //Set/Get Elevator Floor
|
||||
public static final int NET_CLIENT_ELEVATOR_STATE = 324; //Get Elevator State
|
||||
public static final int NET_CLIENT_ELEVATOR_STATISTICS = 325; //Set/Get Elevator Statistics
|
||||
public static final int MIN_LOOR_LEVING = -20;
|
||||
|
||||
|
||||
public static class RECT extends Structure implements ByValue {
|
||||
public int left;
|
||||
public int top;
|
||||
public int right;
|
||||
public int bottom;
|
||||
}
|
||||
|
||||
public static class SDK_VERSION extends Structure {
|
||||
public short m_ulMajorVersion;
|
||||
public short m_ulMinorVersion;
|
||||
public short m_ulBuilder;
|
||||
public String m_cVerInfo;
|
||||
}
|
||||
|
||||
public static class LogonPara extends Structure {
|
||||
public int iSize; //Structure size
|
||||
public byte[] cProxy = new byte[32]; //The ip address of the upper-level proxy to which the video is connected,not more than 32 characters, including '\0'
|
||||
public byte[] cNvsIP = new byte[32]; //IP address, not more than 32 characters, including '\0'
|
||||
public byte[] cNvsName = new byte[32]; //Nvs name. Used for domain name resolution
|
||||
public byte[] cUserName = new byte[16]; //Login Nvs username, not more than 16 characters, including '\0'
|
||||
public byte[] cUserPwd = new byte[16]; //Login Nvs password, not more than 16 characters, including '\0'
|
||||
public byte[] cProductID = new byte[32]; //Product ID, not more than 32 characters, including '\0'
|
||||
public int iNvsPort; //The communication port used by the Nvs server, if not specificed,Use the system default port(3000)
|
||||
public byte[] cCharSet = new byte[32]; //Character set
|
||||
public byte[] cAccontName = new byte[16]; //The username that connects to the contents server
|
||||
public byte[] cAccontPasswd = new byte[16]; //The password that connects to the contents server
|
||||
};
|
||||
|
||||
public static class CLIENTINFO extends Structure {
|
||||
public CLIENTINFO() {
|
||||
allocateMemory();
|
||||
}
|
||||
public int m_iServerID;
|
||||
public int m_iChannelNo;
|
||||
public byte[] m_cNetFile = new byte[255];
|
||||
public byte[] m_cRemoteIP = new byte[16];
|
||||
public int m_iNetMode;
|
||||
public int m_iTimeout;
|
||||
public int m_iTTL;
|
||||
public int m_iBufferCount;
|
||||
public int m_iDelayNum;
|
||||
public int m_iDelayTime;
|
||||
public int m_iStreamNO;
|
||||
public int m_iFlag;
|
||||
public int m_iPosition;
|
||||
public int m_iSpeed;
|
||||
}
|
||||
|
||||
|
||||
public static class ENCODERINFO extends Structure {
|
||||
public byte[] m_cHostName = new byte[32];
|
||||
public byte[] m_cEncoder = new byte[16];
|
||||
public int m_iRecvMode;
|
||||
public byte[] m_cProxy = new byte[16];
|
||||
public byte[] m_cFactoryID = new byte[32]; //ProductID
|
||||
public int m_iPort;//NVS port
|
||||
public int m_nvsType; //NVS type(NVS_T or NVS_S or DVR ...eg)
|
||||
public int m_iChanNum;
|
||||
public int m_iLogonState;
|
||||
public int m_iServerType;
|
||||
}
|
||||
|
||||
public static class PicTime extends Structure {
|
||||
|
||||
public int uiYear;
|
||||
public int uiMonth;
|
||||
public int uiDay;
|
||||
public int uiWeek;
|
||||
public int uiHour;
|
||||
public int uiMinute;
|
||||
public int uiSecondsr;
|
||||
public int uiMilliseconds;
|
||||
}
|
||||
|
||||
public static class PicData extends Structure {
|
||||
|
||||
public PicTime tPicTime;
|
||||
public int iDataLen;
|
||||
public Pointer pcPicData;
|
||||
}
|
||||
|
||||
public static class VcaPicStream extends Structure {
|
||||
|
||||
public int iStructLen;
|
||||
public int iWidth;
|
||||
public int iHeight;
|
||||
public int iChannelID;
|
||||
public int iEventType;
|
||||
public int iRuleID;
|
||||
public int iTargetID;
|
||||
public int iTargetType;
|
||||
public int iTargetSpeed;
|
||||
public int iTargetDirection;
|
||||
public RECT tTargetPosition;
|
||||
public int iPresetNo;
|
||||
public byte[] m_cRemoteIP = new byte[16];
|
||||
public int iPicCount;
|
||||
public PicData[] tPicData = new PicData[3];
|
||||
}
|
||||
|
||||
public static class FaceAttribute extends Structure {
|
||||
public int iType;
|
||||
public int iValue;
|
||||
}
|
||||
|
||||
public static class FacePicData extends Structure {
|
||||
|
||||
public int iFaceId;
|
||||
public int iDrop;
|
||||
public int iFaceLevel;
|
||||
public RECT tFaceRect;
|
||||
public int iWidth;
|
||||
public int iHeight;
|
||||
public int iFaceAttrCount; //Number of face attributes
|
||||
public int iFaceAttrStructSize; //The size of strcut FaceAttribute
|
||||
public Pointer[] ptFaceAttr = new Pointer[256]; //Face attributes,supports up to 256 attribute types,the subscript is the face attribute type://0-age,1-gender,2-masks,3-beard,4-eye open,5-mouth,6-glasses,7-race,8-emotion,9-smile,10-value......
|
||||
public int iDataLen;
|
||||
public Pointer pcPicData;
|
||||
}
|
||||
|
||||
public static class FacePicStream extends Structure {
|
||||
|
||||
public int iStructLen;
|
||||
public int iSizeOfFull; //The size of strcut PicData
|
||||
public Pointer tFullData;
|
||||
public int iFaceCount;
|
||||
public int iSizeOfFace; //The size of strcut FacePicData
|
||||
public Pointer[] tPicData = new Pointer[32];
|
||||
}
|
||||
|
||||
public static class PICSTREAM_INFO extends Structure {
|
||||
|
||||
public byte[] RecvBuffer = new byte[200*1024];//Here should be no less than the maximum alarm message length
|
||||
}
|
||||
|
||||
|
||||
public static interface MAIN_NOTIFY extends Callback {
|
||||
void MainNotify(int _iLogonID, int _iwParam, Pointer _ilParam,
|
||||
Pointer _pUserData);
|
||||
}
|
||||
|
||||
public static interface ALARM_NOTIFY extends Callback {
|
||||
void AlarmNotify(int _iLogonID, int _iChannel,
|
||||
int _iAlarmState, int _iAlarmType, Pointer _pUserData);
|
||||
}
|
||||
|
||||
public static interface PARACHANGE_NOTIFY extends Callback {
|
||||
void ParaChangeNotify(int _iLogonID, int _iChannel, int _iParaType,
|
||||
Pointer _strPara, Pointer _pUserData);
|
||||
}
|
||||
|
||||
public static interface COMRECV_NOTIFY extends Callback {
|
||||
void ComRecvNotify(int _iLogonID, Pointer _pData, int _iLen,
|
||||
int _iComNo, Pointer _pUserData);
|
||||
}
|
||||
|
||||
public static interface PROXY_NOTIFY extends Callback {
|
||||
void ProxyNotify(int _iLogonID, int _iCmdKey, Pointer _pData,
|
||||
int _iLen, Pointer _pUserData);
|
||||
}
|
||||
|
||||
public static interface RECVDATA_NOTIFY extends StdCallCallback {
|
||||
void RecvDataNotify(int _ulID, Pointer _ucData, int _iLen, int _iFlag,
|
||||
Pointer _lpUserData);
|
||||
}
|
||||
|
||||
public static interface NVSDATA_NOTIFY extends Callback {
|
||||
void NvsDataNotify(int _uiID, Pointer _pucData, int _iLen, Pointer _iUser);
|
||||
}
|
||||
|
||||
public static interface NET_PICSTREAM_NOTIFY extends StdCallCallback {
|
||||
int PicDataNotify(int _ulID, int _lCommand, Pointer _tInfo, int _iLen,
|
||||
Pointer _lpUserData);
|
||||
}
|
||||
|
||||
public static class NetPicPara extends Structure {
|
||||
public int iStructLen; //Structure length
|
||||
public int iChannelNo;
|
||||
public NET_PICSTREAM_NOTIFY cbkPicStreamNotify;
|
||||
public Pointer pvUser;
|
||||
}
|
||||
|
||||
public static class PointerSize extends Structure {
|
||||
public Pointer pPointer;
|
||||
}
|
||||
|
||||
public static class NVS_FILE_TIME extends Structure implements ByValue {
|
||||
public short iYear; // Year
|
||||
public short iMonth; // Month
|
||||
public short iDay; // Day
|
||||
public short iHour; // Hour
|
||||
public short iMinute; // Minute
|
||||
public short iSecond; // Second
|
||||
}
|
||||
|
||||
public static class QueryFileChannel extends Structure{
|
||||
public int iChannelNo;
|
||||
public int iStreamNo;
|
||||
}
|
||||
|
||||
public static class ArrayQueryFileChannel extends Structure {
|
||||
public QueryFileChannel[] tArry = new QueryFileChannel[2];
|
||||
}
|
||||
|
||||
public static class NETFILE_QUERY_V5 extends Structure {
|
||||
public int iBufSize; //Size of the structure
|
||||
public int iQueryChannelNo; //query channel no, 0x7FFFFFFF means query all channel
|
||||
public int iStreamNo; //stream no
|
||||
public int iType; //Video type 33:ATM
|
||||
public NVS_FILE_TIME tStartTime; //Start time
|
||||
public NVS_FILE_TIME tStopTime; //End time
|
||||
public int iPageSize; //Page size
|
||||
public int iPageNo; //Page number
|
||||
public int iFiletype; //File type 0:all,1:Video,2:picture
|
||||
public int iDevType; //Device type 0:Video camera,1:Network video server,2:Web camera ,0xff: all
|
||||
public byte[] cOtherQuery = new byte[65]; //Character overlay
|
||||
public int iTriggerType; //Alarm type 3:Port alarm,4:Mobile alarm ,5:Video loss alarm ,0x7FFFFFFF:invalid
|
||||
public int iTrigger; //Port(channel)number
|
||||
public int iQueryType; //Query type 0: Basic query 1:ATM query 2: ITS query
|
||||
public int iQueryCondition; //Query criteria 0: Domain query 1: According to the card number query ; 2: Traffic query condition:
|
||||
public byte[] cField = new byte[5 * 68]; //Query message
|
||||
public int iQueryChannelCount; //if iQueryChannelCount = 0, query single channel with iQueryChannelNo
|
||||
public int iBufferSize; //sizeof(QueryFileChannel)
|
||||
public Pointer ptChannelList; //buffer len = sizeof(QueryFileChannel)*iQueryChannelCount
|
||||
public byte[] cLaneNo = new byte[65]; //lane no
|
||||
public byte[] cVehicleType = new byte[65]; //vehicle type
|
||||
public int iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage
|
||||
}
|
||||
|
||||
//Record File Property
|
||||
public static class NVS_FILE_DATA extends Structure {
|
||||
public int iType; //Record type 1-Manual record, 2-Schedule record, 3-Alarm record
|
||||
public int iChannel; //Record channel 0~channel defined channel number
|
||||
public byte[] cFileName = new byte[250]; //File name
|
||||
public NVS_FILE_TIME tStartTime; //File start time
|
||||
public NVS_FILE_TIME tStopTime; //File end time
|
||||
public int iFileSize; //File size
|
||||
};
|
||||
|
||||
public static class NVS_FILE_DATA_EX extends Structure {
|
||||
public int iSize;
|
||||
public NVS_FILE_DATA tFileData; //file basic information
|
||||
public int iLocked; //add unlock state
|
||||
public int iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage
|
||||
};
|
||||
|
||||
public static class DOWNLOAD_FILE extends Structure {
|
||||
public int m_iSize; //Structure size
|
||||
public byte[] m_cRemoteFilename = new byte[255]; //Fornt end video file name
|
||||
public byte[] m_cLocalFilename = new byte[255]; //Local video file name
|
||||
public int m_iPosition; //File location by percentage 0~100;When continue send after stop send,file pointer offset request
|
||||
public int m_iSpeed; //1, 2, 4, 8, Control file play speed, 0-Suspend
|
||||
public int m_iIFrame; //Only send I frame 1,Only play I Frame;0, All play
|
||||
public int m_iReqMode; //Require data mode 1,Frame mode;0,Stream mode
|
||||
public int m_iRemoteFileLen; //If local file is not null, the parameter set to null
|
||||
public int m_iVodTransEnable; //Enable
|
||||
public int m_iVodTransVideoSize; //Video pixel
|
||||
public int m_iVodTransFrameRate; //Frame rate
|
||||
public int m_iVodTransStreamRate; //Code rate
|
||||
public int m_iSaveFileType; //0:SDV 3:ps
|
||||
public int m_iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage
|
||||
public int m_iCryptType; //iCryptType = 0, no encryption; iCryptType = 1, is AES encryption
|
||||
public byte[] m_cCryptKey = new byte[32];
|
||||
};
|
||||
|
||||
public static class DOWNLOAD_TIMESPAN extends Structure {
|
||||
public int m_iSize; //Structure size
|
||||
public byte[] m_cLocalFilename = new byte[255]; //Local video file name
|
||||
public int m_iChannelNO; //Channel number
|
||||
public NVS_FILE_TIME m_tTimeBegin; //Start time
|
||||
public NVS_FILE_TIME m_tTimeEnd; //End time
|
||||
public int m_iPosition; //Position according to time point,>100
|
||||
public int m_iSpeed; //1, 2, 4, 8, Control file playback speed, 0-Suspend
|
||||
public int m_iIFrame; //Only I frames 1,I only play; 0,Full play
|
||||
public int m_iReqMode; //Required data model 1,Frame mode;0,Flow pattern
|
||||
public int m_iVodTransEnable; //Enable
|
||||
public int m_iVodTransVideoSize; //Video frequency ratio
|
||||
public int m_iVodTransFrameRate; //Frame rate
|
||||
public int m_iVodTransStreamRate; //Code Rate
|
||||
public int m_iFileFlag; //0:Download multiple files 1:Download into a single file
|
||||
public int m_iSaveFileType; //0:SDV 3:ps
|
||||
public int m_iStreamNo; //stream number,0-main stream, 1-sub stream
|
||||
public int m_iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage
|
||||
public int m_iCryptType; //iCryptType = 0, no encryption; iCryptType = 1, is AES encryption
|
||||
public byte[] m_cCryptKey = new byte[32];
|
||||
};
|
||||
|
||||
public static class DOWNLOAD_CONTROL extends Structure {
|
||||
public int m_iSize; //Structure size
|
||||
public int m_iPosition; //0~100, Location file playback ; -1, Does not carry on the localization
|
||||
public int m_iSpeed; //1, 2, 4, 8, Control file playback speed, 0-Suspend
|
||||
public int m_iIFrame; //Only I frames 1,I only play;0,Full play
|
||||
public int m_iReqMode; //Demand data model 1,Frame mode ;0,Flow pattern
|
||||
};
|
||||
|
||||
public static class RAWFRAME_INFO extends Structure {
|
||||
public int nWidth; //Video width, audio data is 0
|
||||
public int nHeight; //Video height, audio data is 0
|
||||
public int nStamp; //Time stamp(ms)
|
||||
public int nType; //RAWFRAMETYPE, I Frame:0,P Frame:1,B Frame:2,Audio:5
|
||||
public int nEnCoder; //Audio or Video encoder(Video,0:H263,1:H264, 2:MP4. Audio:0,G711_A:0x01,G711_U:0x02,ADPCM_A:0x03,G726:0x04)
|
||||
public int nFrameRate; //Frame rate
|
||||
public int nAbsStamp; //Absolute Time(s)
|
||||
public byte ucBitsPerSample; // bit per sample [8/16/24] default 16
|
||||
public int uiSamplesPerSec; // Samples Per Sec, default 8000
|
||||
};
|
||||
|
||||
//Not decode the standard data before the pure h264 data
|
||||
public static interface RAWFRAME_NOTIFY extends StdCallCallback {
|
||||
void rawFrameNotify(int _uiID, Pointer _pcData, int _iLen, RAWFRAME_INFO _ptRawFrameInfo, Pointer _pvUsrData);
|
||||
}
|
||||
|
||||
public static class FRAME_INFO extends Structure {
|
||||
public int nWidth; //Video width, audio data is 0;
|
||||
public int nHeight; //Video height, audio data is 0;
|
||||
public int nStamp; //Time stamp(ms).
|
||||
public int nType; //Audio type: 0--T_AUDIO8, 1-T_YUV420
|
||||
public int nFrameRate; //Frame rate
|
||||
public Pointer nReserved; //reserve
|
||||
};
|
||||
public static interface DECYUV_NOTIFY_V4 extends Callback {
|
||||
void decYuvNotify(int _uiID, Pointer _pcData, int _iLen, FRAME_INFO _pFrameInfo, Pointer _pvUser);
|
||||
}
|
||||
|
||||
public static class COMFORMAT extends Structure {
|
||||
public int iSize; //Size of the structure,must be initialized before used
|
||||
public int iComNo; //Serial number
|
||||
public byte[] cDeviceName = new byte[32]; //Protocol name
|
||||
public byte[] cComFormat = new byte[32]; //Format serial 9600,n,8,1
|
||||
public int iWorkMode; //Working mode 1:Protocol control,2:Transparent channel,3:Industry reserve ,4:7601B Serial alarm host,5:485 kerboard
|
||||
public int iComType; //Serial type 0:485,1:232,2:422
|
||||
}
|
||||
|
||||
public static class FuncAbilityLevel extends Structure {
|
||||
public int iSize;
|
||||
public int iMainFuncType; //main function type
|
||||
public int iSubFuncType; //sub function type
|
||||
public byte[] cParam = new byte[1024]; //Capability Description
|
||||
}
|
||||
|
||||
|
||||
//Elevator business
|
||||
public static class ElevatorMonitor extends Structure
|
||||
{
|
||||
public ElevatorMonitor() {
|
||||
allocateMemory();
|
||||
}
|
||||
public int iChannelNo; //channel number reserved
|
||||
public int iStartShockThreshold;//Start shock threshold Unit: mgal Range: 0-100000
|
||||
public int iMoveSpeed; //Normal running speed Unit: mm/s Range: 0-3500
|
||||
public int iBodyInductionMode; //person detection mode 0-video detection 1-PIR 2-automatic
|
||||
public int iEbikeDetectEnable; //Electric vehicle entering elevator alarm 0-disable 1-enable
|
||||
public int iSwaySensitivity; //Shake alarm sensitivity range 0-100
|
||||
public int iTopLimit; //The highest floor
|
||||
public int iBottomLimit; //The lowest floor
|
||||
public int iMainFloor; //Base station layer
|
||||
public int iLevelingMode; //leveling signal valid type 0-low valid 1-high valid 2-upper edge (reserved) 3-lower edge (reserved)
|
||||
public int iOpenDoorMode; //Valid type of door switch signal 0-low valid 1-high valid 2-upper edge (reserved) 3-lower edge (reserved)
|
||||
public int iMaintenanceMode; //check valid type 0-low valid 1-high valid 2-upper edge (reserved) 3-lower edge (reserved)
|
||||
public int iCrashStopMode; //Emergency stop valid type 0-low valid 1-high valid 2-upper edge (reserved) 3-lower edge (reserved)
|
||||
public int iPIRMode; //PIR signal valid type 0-low valid 1-high valid 2-upper edge (reserved) 3-lower edge (reserved)
|
||||
};
|
||||
|
||||
|
||||
public static class ElevatorStoreyInfo extends Structure
|
||||
{
|
||||
public ElevatorStoreyInfo() {
|
||||
allocateMemory();
|
||||
}
|
||||
int iChannelNo; //channel number public int
|
||||
public int iStartFloor; //Start floor
|
||||
public int iEndFloor; //End floor
|
||||
public int [] iFloorHeight = new int[256]; //floor height
|
||||
};
|
||||
|
||||
|
||||
public static class ElevatorState extends Structure
|
||||
{
|
||||
public ElevatorState() {
|
||||
allocateMemory();
|
||||
}
|
||||
public int iChannelNo; //channel number reserved
|
||||
public int iFloor; //floor code current floor
|
||||
public int iDirection ; //Direction Direction: 0-no direction 1-upward 2-downward
|
||||
public int iSpeed; //Running speed Current running speed
|
||||
public int iTemperature; //Temperature temperature value (unit: Celsius*10)
|
||||
public int iHumidity; //humidity relative humidity (unit: %*10)
|
||||
public int iBindBrake; //brake state 0-brake closed 1-brake open
|
||||
public int iMaintenance; //maintenance status 0-maintenance status 1-non-maintenance status
|
||||
public int iLeveling; //leveling status 0-no longer leveling 1-leveling
|
||||
public int iOpenDoor; //car door status 0-car door closed 1-car door open
|
||||
public int iCrashStop; //Emergency stop status 0-normal 1-emergency stop
|
||||
public int iBodyInduction; //person detection status 0-no one 1-someone
|
||||
public int iMainFloor; //Base station status 0-no longer base station 1-in base station
|
||||
|
||||
};
|
||||
|
||||
public static class ElevatorStatistics extends Structure
|
||||
{
|
||||
public ElevatorStatistics() {
|
||||
allocateMemory();
|
||||
}
|
||||
public int iChannelNo; //channel number reserved
|
||||
public int iBindBrakeCn; // Brake times Accumulated statistics of brake times
|
||||
public int iOpenDoorCn; //The times of opening and closing the door, the cumulative number of times of opening and closing the door
|
||||
public int iOperationMileage; //Running distance Cumulative statistical running distance Unit mm
|
||||
};
|
||||
|
||||
public static class vca_TPoint extends Structure {
|
||||
public int iX;
|
||||
public int iY;
|
||||
};
|
||||
|
||||
public static final int MAX_3D_LOCATE_POINT_NUM = 2;
|
||||
public static class Locate3DPosition extends Structure {
|
||||
public int iBufSize;
|
||||
public int iPointNum;
|
||||
public vca_TPoint[] tPoint = new vca_TPoint[MAX_3D_LOCATE_POINT_NUM];
|
||||
};
|
||||
|
||||
int NetClient_GetVersion(SDK_VERSION _ver);
|
||||
|
||||
int NetClient_SetNotifyFunction_V4(MAIN_NOTIFY _cbkMainNotify,
|
||||
ALARM_NOTIFY _cbkAlarmNotify,
|
||||
PARACHANGE_NOTIFY _cbkParaChangeNotify,
|
||||
COMRECV_NOTIFY _cbkComRecv,
|
||||
PROXY_NOTIFY _cbkProxyNotify);
|
||||
|
||||
int NetClient_SetPort(int _iServerPort, int _iClientPort);
|
||||
|
||||
int NetClient_Startup_V4(int _iServerPort, int _iClientPort, int _iWnd);
|
||||
|
||||
int NetClient_Cleanup();
|
||||
|
||||
int NetClient_Logon(String _cProxy, String _cIP, String _cUserName,
|
||||
String _cPassword, String _pcProID, int _iPort);
|
||||
|
||||
int NetClient_Logon_V4(int _iLogonType, Pointer _pvPara, int _iInBufSize);
|
||||
|
||||
int NetClient_Logoff(int _iLogonID);
|
||||
|
||||
int NetClient_StartRecvEx(IntByReference _ulConID, CLIENTINFO _cltInfo,
|
||||
RECVDATA_NOTIFY _cbkDataNotify, Pointer _pUserData);
|
||||
|
||||
int NetClient_StartRecv_V4(IntByReference _uiRecvID, CLIENTINFO _cltInfo
|
||||
, NVSDATA_NOTIFY _cbkDataArrive, Pointer _iUserData);
|
||||
|
||||
int NetClient_StartRecvNetPicStream(int _iLogonID, NetPicPara _ptPara, int _iBufLen, IntByReference _puiRecvID);
|
||||
|
||||
int NetClient_StopRecv(int _uiConID);
|
||||
|
||||
int NetClient_StartCaptureData(int _uiConID);
|
||||
|
||||
int NetClient_StopCaptureData(int _uiID);
|
||||
|
||||
int NetClient_StartPlay(int _ulConID, int _hWnd, RECT _rcShow, int _iDecflag);
|
||||
|
||||
int NetClient_StopPlay(int _ulConID);
|
||||
|
||||
int NetClient_StartCaptureFile(int _uiConID, String _cFileName, int _iRecFileType);
|
||||
|
||||
int NetClient_StopCaptureFile(int _uiConID);
|
||||
|
||||
int NetClient_GetLogonStatus(int _iLogonID);
|
||||
|
||||
int NetClient_GetDevInfo(int _iLogonID,ENCODERINFO _pEncoderInfo);
|
||||
|
||||
int NetClient_Query_V4(int _iLogonID, int _iCmd, int _iChannel, Pointer _pvCmdBuf, int _iBufLen);
|
||||
|
||||
int NetClient_NetFileGetFileCount(int _iLogonID, IntByReference _piTotalCount, IntByReference _piCurrentCount);
|
||||
|
||||
int NetClient_NetFileGetQueryfileEx(int _iLogonID,int _iFileIndex, NVS_FILE_DATA_EX _pFileInfo);
|
||||
|
||||
int NetClient_NetFileDownload(IntByReference _uiConID, int _iLogonID, int _iCmd, Pointer _pvBuf, int _iBufSize);
|
||||
|
||||
int NetClient_NetFileStopDownloadFile(int _uiConID);
|
||||
|
||||
int NetClient_NetFileGetDownloadPos(int _uiConID, IntByReference _piPos, IntByReference _piDLSize);
|
||||
|
||||
int NetClient_SetRawFrameCallBack(int _uiConID, RAWFRAME_NOTIFY _cbkGetFrame, Pointer _pContext);
|
||||
|
||||
int NetClient_SetDecCallBack_V4(int _uiConID, DECYUV_NOTIFY_V4 _cbkDecYUV, Pointer _pvUserData);
|
||||
|
||||
int NetClient_GetDeviceType(int _iLogonID, int _iChannelNo, IntByReference _piComPort
|
||||
, IntByReference _iDevAddress, Pointer _cDeviceType);
|
||||
|
||||
int NetClient_GetComFormat_V2(int _iLogonID, COMFORMAT _ptComFormat);
|
||||
|
||||
int NetClient_SetComFormat_V2(int _iLogonID, COMFORMAT _ptComFormat);
|
||||
|
||||
int NetClient_DeviceCtrlEx(int _iLogonID, int _iChannelNo, int _iActionType, int _iParam1, int _iParam2, int _iControlType);
|
||||
|
||||
int NetClient_CapturePicture(int _uiConID, int _iPicType, String strFileName);
|
||||
|
||||
int NetClient_CapturePic(int _uiConID, PointerByReference _pucData);
|
||||
|
||||
int NetClient_GetSensorFlip(int _iLogonID, int _iChannel, IntByReference _piFlip);
|
||||
|
||||
int NetClient_GetChannelProperty(int _iLogonID, int _iChannel, int _iCmd, Pointer _pvBuf, int _iBufSize);
|
||||
|
||||
int NetClient_DigitalChannelSend(int _iLogonID, int _iChannel, byte[] _ucBuf, int _iLength);
|
||||
|
||||
int NetClient_ComSend(int _iLogonID, byte[] _ucBuf, int _iLength, int _iComNo);
|
||||
|
||||
int NetClient_SendCommand(int _iLogonID, int _iCommand, int _iChannel, Pointer _pvBuffer, int _iBufSize);
|
||||
|
||||
int NetClient_GetDevConfig(int _iLogonID, int _iCommand, int _iChannel, Pointer _pvOutBuffer
|
||||
, int _iOutBufferSize, IntByReference _piBytesReturned);
|
||||
|
||||
int NetClient_SetDevConfig(int _iLogonID, int _iCommand, int _iChannel, Pointer _lpInBuffer, int _iInBufferSize);
|
||||
}
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
package com.whdc.video;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
import com.whdc.playback.NVSSDK;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
public class NetClient1 {
|
||||
|
||||
private static NVSSDK1 nvssdk = (NVSSDK1)(System.getProperty("os.name").toLowerCase().startsWith("win")?Native.loadLibrary("NVSSDK.dll",NVSSDK.class):Native.loadLibrary("libnvssdk.so", NVSSDK.class));
|
||||
|
||||
public static int GetVersion(NVSSDK1.SDK_VERSION _ver) {
|
||||
return nvssdk.NetClient_GetVersion(_ver);
|
||||
}
|
||||
|
||||
public static int SetNotifyFunction(NVSSDK1.MAIN_NOTIFY _cbkMainNotify,
|
||||
NVSSDK1.ALARM_NOTIFY _cbkAlarmNotify, NVSSDK1.PARACHANGE_NOTIFY _cbkParaChangeNotify) {
|
||||
return nvssdk.NetClient_SetNotifyFunction_V4(_cbkMainNotify, _cbkAlarmNotify, _cbkParaChangeNotify, null, null);
|
||||
}
|
||||
|
||||
public static int SetPort(int _iServerPort, int _iClientPort) {
|
||||
return nvssdk.NetClient_SetPort(_iServerPort, _iClientPort);
|
||||
}
|
||||
|
||||
public static int Startup() {
|
||||
return nvssdk.NetClient_Startup_V4(0, 0, 0);
|
||||
}
|
||||
|
||||
public static int Cleanup() {
|
||||
return nvssdk.NetClient_Cleanup();
|
||||
}
|
||||
|
||||
public static int Logon(String _cProxy, String _cIP, String _cUserName,
|
||||
String _cPassword, String _pcProID, int _iPort) {
|
||||
return nvssdk.NetClient_Logon(_cProxy, _cIP, _cUserName,
|
||||
_cPassword, _pcProID, _iPort);
|
||||
}
|
||||
|
||||
public static int Logon_V4(int _iLogonType, Pointer _pvPara, int _iInBufSize) {
|
||||
return nvssdk.NetClient_Logon_V4(_iLogonType, _pvPara, _iInBufSize);
|
||||
}
|
||||
|
||||
public static int Logoff(int _iLogonID) {
|
||||
return nvssdk.NetClient_Logoff(_iLogonID);
|
||||
}
|
||||
|
||||
public static int StartRecv(IntByReference _ulConID, NVSSDK1.CLIENTINFO _cltInfo,
|
||||
NVSSDK1.RECVDATA_NOTIFY _cbkDataNotify) {
|
||||
return nvssdk.NetClient_StartRecvEx(_ulConID, _cltInfo,
|
||||
_cbkDataNotify, Pointer.NULL);
|
||||
}
|
||||
|
||||
public static int StartRecv_V4(IntByReference _uiRecvID, NVSSDK1.CLIENTINFO _cltInfo
|
||||
, NVSSDK1.NVSDATA_NOTIFY _cbkDataArrive, Pointer _iUserData) {
|
||||
return nvssdk.NetClient_StartRecv_V4(_uiRecvID, _cltInfo, _cbkDataArrive, _iUserData);
|
||||
}
|
||||
|
||||
public static int StopRecv(int _ulConID) {
|
||||
return nvssdk.NetClient_StopRecv(_ulConID);
|
||||
}
|
||||
|
||||
public static int StartCaptureData(int _ulConID) {
|
||||
return nvssdk.NetClient_StartCaptureData(_ulConID);
|
||||
}
|
||||
|
||||
public static int StopCaptureData(int _ulConID) {
|
||||
return nvssdk.NetClient_StopCaptureData(_ulConID);
|
||||
}
|
||||
|
||||
public static int StartPlay(int _ulConID, Component _hWnd, int _iDecflag) {
|
||||
NVSSDK1.RECT rcShow = new NVSSDK1.RECT();
|
||||
return nvssdk.NetClient_StartPlay(_ulConID, 0, rcShow,
|
||||
_iDecflag);
|
||||
}
|
||||
|
||||
public static int StopPlay(int _ulConID) {
|
||||
return nvssdk.NetClient_StopPlay(_ulConID);
|
||||
}
|
||||
|
||||
public static int StartCaptureFile(int _ulConID, String _cFileName,
|
||||
int _iRecFileType) {
|
||||
return nvssdk.NetClient_StartCaptureFile(_ulConID,
|
||||
_cFileName, _iRecFileType);
|
||||
}
|
||||
|
||||
public static int StopCaptureFile(int _ulConID) {
|
||||
return nvssdk.NetClient_StopCaptureFile(_ulConID);
|
||||
}
|
||||
|
||||
public static int StartRecvNetPicStream(int _iLogonID, NVSSDK1.NetPicPara _ptPara, int _iBufLen, IntByReference _puiRecvID) {
|
||||
return nvssdk.NetClient_StartRecvNetPicStream(_iLogonID, _ptPara, _iBufLen, _puiRecvID);
|
||||
}
|
||||
|
||||
public static int GetLogonStatus(int _iLogonID) {
|
||||
return nvssdk.NetClient_GetLogonStatus(_iLogonID);
|
||||
}
|
||||
|
||||
public static int GetDevInfo(int _iLogonID ,NVSSDK1.ENCODERINFO _pEncoderInfo) {
|
||||
return nvssdk.NetClient_GetDevInfo(_iLogonID, _pEncoderInfo);
|
||||
}
|
||||
|
||||
public static int Query_V4(int _iLogonID, int _iCmd, int _iChannel, Pointer _pvCmdBuf, int _iBufLen) {
|
||||
return nvssdk.NetClient_Query_V4(_iLogonID, _iCmd, _iChannel, _pvCmdBuf, _iBufLen);
|
||||
}
|
||||
|
||||
public static int NetFileGetFileCount(int _iLogonID, IntByReference _piTotalCount, IntByReference _piCurrentCount) {
|
||||
return nvssdk.NetClient_NetFileGetFileCount(_iLogonID, _piTotalCount, _piCurrentCount);
|
||||
}
|
||||
|
||||
public static int NetFileGetQueryfileEx(int _iLogonID, int _iFileIndex, NVSSDK1.NVS_FILE_DATA_EX _pFileInfo) {
|
||||
return nvssdk.NetClient_NetFileGetQueryfileEx(_iLogonID, _iFileIndex, _pFileInfo);
|
||||
}
|
||||
|
||||
public static int NetFileDownload(IntByReference _uiConID, int _iLogonID, int _iCmd, Pointer _pvBuf, int _iBufSize) {
|
||||
return nvssdk.NetClient_NetFileDownload(_uiConID, _iLogonID, _iCmd, _pvBuf, _iBufSize);
|
||||
}
|
||||
|
||||
public static int NetFileStopDownloadFile(int _uiConID) {
|
||||
return nvssdk.NetClient_NetFileStopDownloadFile(_uiConID);
|
||||
}
|
||||
|
||||
public static int NetFileGetDownloadPos(int _uiConID, IntByReference _piPos, IntByReference _piDLSize) {
|
||||
return nvssdk.NetClient_NetFileGetDownloadPos(_uiConID, _piPos, _piDLSize);
|
||||
}
|
||||
|
||||
public static int SetRawFrameCallBack(int _uiConID, NVSSDK1.RAWFRAME_NOTIFY _cbkGetFrame, Pointer _pContext) {
|
||||
return nvssdk.NetClient_SetRawFrameCallBack(_uiConID, _cbkGetFrame, _pContext);
|
||||
}
|
||||
|
||||
public static int SetDecCallBack_V4(int _uiConID, NVSSDK1.DECYUV_NOTIFY_V4 _cbkDecYUV, Pointer _pvUserData) {
|
||||
return nvssdk.NetClient_SetDecCallBack_V4(_uiConID, _cbkDecYUV, _pvUserData);
|
||||
}
|
||||
|
||||
public static int GetDeviceType(int _iLogonID, int _iChannelNo, IntByReference _piComPort
|
||||
, IntByReference _iDevAddress, Pointer _cDeviceType) {
|
||||
return nvssdk.NetClient_GetDeviceType(_iLogonID, _iChannelNo, _piComPort, _iDevAddress, _cDeviceType);
|
||||
}
|
||||
|
||||
public static int GetComFormat_V2(int _iLogonID, NVSSDK1.COMFORMAT _ptComFormat) {
|
||||
return nvssdk.NetClient_GetComFormat_V2(_iLogonID, _ptComFormat);
|
||||
}
|
||||
|
||||
public static int SetComFormat_V2(int _iLogonID, NVSSDK1.COMFORMAT _ptComFormat) {
|
||||
return nvssdk.NetClient_SetComFormat_V2(_iLogonID, _ptComFormat);
|
||||
}
|
||||
|
||||
public static int DeviceCtrlEx(int _iLogonID, int _iChannelNo, int _iActionType
|
||||
, int _iParam1, int _iParam2, int _iControlType) {
|
||||
return nvssdk.NetClient_DeviceCtrlEx(_iLogonID, _iChannelNo, _iActionType, _iParam1, _iParam2, _iControlType);
|
||||
}
|
||||
|
||||
public static int CapturePicture(int _uiConID, int _iPicType, String strFileName) {
|
||||
return nvssdk.NetClient_CapturePicture(_uiConID, _iPicType, strFileName);
|
||||
}
|
||||
|
||||
public static int CapturePic(int _uiConID, PointerByReference _pucData) {
|
||||
return nvssdk.NetClient_CapturePic(_uiConID, _pucData);
|
||||
}
|
||||
|
||||
public static int GetSensorFlip(int _iLogonID, int _iChannel, IntByReference _piFlip) {
|
||||
return nvssdk.NetClient_GetSensorFlip(_iLogonID, _iChannel, _piFlip);
|
||||
}
|
||||
|
||||
public static int GetChannelProperty(int _iLogonID, int _iChannel, int _iCmd, Pointer _pvBuf, int _iBufSize) {
|
||||
return nvssdk.NetClient_GetChannelProperty(_iLogonID, _iChannel, _iCmd, _pvBuf, _iBufSize);
|
||||
}
|
||||
|
||||
public static int DigitalChannelSend(int _iLogonID, int _iChannel, byte[] _ucBuf, int _iLength) {
|
||||
return nvssdk.NetClient_DigitalChannelSend(_iLogonID, _iChannel, _ucBuf, _iLength);
|
||||
}
|
||||
|
||||
public static int ComSend(int _iLogonID, byte[] _ucBuf, int _iLength, int _iComNo) {
|
||||
return nvssdk.NetClient_ComSend(_iLogonID, _ucBuf, _iLength, _iComNo);
|
||||
}
|
||||
|
||||
public static int SendCommand(int _iLogonID, int _iCommand, int _iChannel, Pointer _pvBuffer, int _iBufSize) {
|
||||
return nvssdk.NetClient_SendCommand(_iLogonID, _iCommand, _iChannel, _pvBuffer, _iBufSize);
|
||||
}
|
||||
|
||||
public static int GetDevConfig(int _iLogonID, int _iCommand, int _iChannel, Pointer _pvOutBuffer
|
||||
, int _iOutBufferSize, IntByReference _piBytesReturned) {
|
||||
return nvssdk.NetClient_GetDevConfig(_iLogonID, _iCommand, _iChannel, _pvOutBuffer, _iOutBufferSize, _piBytesReturned);
|
||||
}
|
||||
|
||||
public static int SetDevConfig(int _iLogonID, int _iCommand, int _iChannel, Pointer _lpInBuffer, int _iInBufferSize) {
|
||||
return nvssdk.NetClient_SetDevConfig(_iLogonID, _iCommand, _iChannel, _lpInBuffer, _iInBufferSize);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,35 @@
|
|||
server:
|
||||
port: 12117
|
||||
|
||||
spring:
|
||||
#数据库配置
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://rm-wz9n28sq10rz5b0u2o.mysql.rds.aliyuncs.com:3306/shareddata?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
username: shareddata
|
||||
password: SharedData_890
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
|
||||
#jpa配置
|
||||
jpa:
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.DmDialect
|
||||
|
||||
logging:
|
||||
# level:
|
||||
# org.springframework.boot.autoconfigure: error #spring的自动装配日志只打error,否则debug输出的会打印很多自动装配的log信息到控制台
|
||||
# com.whdc.zhzmkzapi.mapper: error
|
||||
config: classpath:logback-spring.xml
|
||||
mybatis:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
|
||||
mqtt:
|
||||
broker: tcp://120.24.5.249:3189
|
||||
clientId: mqttx_c4d1c22b
|
||||
|
||||
enableMqttListening: true
|
||||
offlineThreshold: 24
|
||||
|
|
@ -0,0 +1,206 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
|
||||
<!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true -->
|
||||
<!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。 当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
|
||||
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
|
||||
<configuration scan="true" scanPeriod="10 seconds">
|
||||
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
|
||||
<contextName>logback</contextName>
|
||||
|
||||
<!-- 文件切割大小 -->
|
||||
<property name="maxFileSize" value="100MB"/>
|
||||
<!-- 文档保留天数 -->
|
||||
<property name="maxHistory" value="3"/>
|
||||
<!-- 文档保留总大小 -->
|
||||
<property name="totalSizeCap" value="1GB"/>
|
||||
|
||||
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 -->
|
||||
<property name="log.path" value="./logs"/>
|
||||
|
||||
<!--0. 日志格式和颜色渲染 -->
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
|
||||
<!-- <property name="CONSOLE_LOG_PATTERN" value="%-12(%d{yyyy-MM-dd HH:mm:ss.SSS}) |-%-5level [%thread] %c [%L] -| %msg%n"/>-->
|
||||
|
||||
<!--1. 输出到控制台-->
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>debug</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
|
||||
<!-- 设置字符集 -->
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--2. 输出到文档-->
|
||||
<!-- 2.1 level为 DEBUG 日志,时间滚动输出 -->
|
||||
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文档的路径及文档名 -->
|
||||
<file>${log.path}/web_debug.log</file>
|
||||
<!--日志文档输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志归档 -->
|
||||
<fileNamePattern>${log.path}/web-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>${maxFileSize}</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文档保留天数-->
|
||||
<maxHistory>${maxHistory}</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文档只记录debug级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>debug</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 2.2 level为 INFO 日志,时间滚动输出 -->
|
||||
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文档的路径及文档名 -->
|
||||
<file>${log.path}/web_info.log</file>
|
||||
<!--日志文档输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 每天日志归档路径以及格式 -->
|
||||
<fileNamePattern>${log.path}/web-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>${maxFileSize}</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文档保留天数-->
|
||||
<maxHistory>${maxHistory}</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文档只记录info级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>info</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 2.3 level为 WARN 日志,时间滚动输出 -->
|
||||
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文档的路径及文档名 -->
|
||||
<file>${log.path}/web_warn.log</file>
|
||||
<!--日志文档输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/web-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>${maxFileSize}</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文档保留天数-->
|
||||
<maxHistory>${maxHistory}</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文档只记录warn级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>warn</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 2.4 level为 ERROR 日志,时间滚动输出 -->
|
||||
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!-- 正在记录的日志文档的路径及文档名 -->
|
||||
<file>${log.path}/web_error.log</file>
|
||||
<!--日志文档输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/web-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>${maxFileSize}</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
<!--日志文档保留天数-->
|
||||
<maxHistory>${maxHistory}</maxHistory>
|
||||
</rollingPolicy>
|
||||
<!-- 此日志文档只记录ERROR级别的 -->
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!--
|
||||
<logger>用来设置某一个包或者具体的某一个类的日志打印级别、以及指定<appender>。<logger>仅有一个name属性, 一个可选的level和一个可选的addtivity属性。
|
||||
name:用来指定受此logger约束的某一个包或者具体的某一个类。
|
||||
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
|
||||
还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。
|
||||
如果未设置此属性,那么当前logger将会继承上级的级别。
|
||||
addtivity:是否向上级logger传递打印信息。默认是true。
|
||||
|
||||
<logger name="org.springframework.web" level="info"/>
|
||||
<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>
|
||||
-->
|
||||
|
||||
<!--
|
||||
使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作:
|
||||
第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息
|
||||
第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别:
|
||||
|
||||
【logging.level.org.mybatis=debug logging.level.dao=debug】
|
||||
-->
|
||||
<logger name="_org.springframework" level="warn"/>
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
<logger name="com.baomidou" level="warn"/>
|
||||
<logger name="org.mybatis.spring" level="error"/>
|
||||
<logger name="org.apache.ibatis" level="warn"/>
|
||||
<logger name="org.apache.http" level="error"/>
|
||||
<logger name="io.lettuce.core" level="error" additivity="false"/>
|
||||
<logger name="springfox.bean" level="error" additivity="false"/>
|
||||
<logger name="springfox.documentation" level="error" additivity="false"/>
|
||||
<logger name="org.hibernate.validator" level="error" additivity="false"/>
|
||||
<logger name="io.netty" level="error" additivity="false"/>
|
||||
<logger name="com.alibaba.druid" level="error" additivity="false"/>
|
||||
<logger name="com.corundumstudio.socketio" level="error" additivity="false"/>
|
||||
<logger name="org.mongodb.driver" level="error" additivity="false"/>
|
||||
<logger name="org.tio" level="warn"/>
|
||||
<logger name="org.apache.kafka" level="error"/>
|
||||
<logger name="Validator" level="error"/>
|
||||
<logger name="com.whdc.zhzmkzapi.tio" level="warn"/>
|
||||
<logger name="com.whdc.zhzmkzv2.config.MQTTConfig" level="error"/>
|
||||
<logger name="com.whdc.zhzmkzv2.mapper" level="error"/>
|
||||
<logger name="org.apache.poi" level="error"/>
|
||||
<logger name="com.alibaba.excel" level="error"/>
|
||||
<!--
|
||||
root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性
|
||||
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,不能设置为INHERITED或者同义词NULL。默认是DEBUG
|
||||
,标识这个appender将会添加到这个logger。
|
||||
-->
|
||||
<root level="debug">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="DEBUG_FILE"/>
|
||||
<appender-ref ref="INFO_FILE"/>
|
||||
<appender-ref ref="WARN_FILE"/>
|
||||
<appender-ref ref="ERROR_FILE"/>
|
||||
</root>
|
||||
</configuration>
|
||||
Loading…
Reference in New Issue