init
parent
9d9f3c4767
commit
2961766c2a
|
|
@ -0,0 +1,38 @@
|
|||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,592 @@
|
|||
2025-11-28 10:10:40.104 [background-preinit] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider
|
||||
2025-11-28 10:10:40.164 [main] DEBUG com.whdc.TdwyApplication - Running with Spring Boot v2.7.1, Spring v5.3.21
|
||||
2025-11-28 10:10:46.691 [main] DEBUG com.zaxxer.hikari.HikariConfig - Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
|
||||
2025-11-28 10:10:50.723 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - HikariPool-1 - configuration:
|
||||
2025-11-28 10:10:50.731 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension................................false
|
||||
2025-11-28 10:10:50.732 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - autoCommit................................true
|
||||
2025-11-28 10:10:50.732 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - catalog................................none
|
||||
2025-11-28 10:10:50.736 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql................................none
|
||||
2025-11-28 10:10:50.739 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery................................none
|
||||
2025-11-28 10:10:50.740 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout................................30000
|
||||
2025-11-28 10:10:50.742 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSource................................none
|
||||
2025-11-28 10:10:50.746 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName................................none
|
||||
2025-11-28 10:10:50.750 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI................................none
|
||||
2025-11-28 10:10:50.753 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties................................{password=<masked>}
|
||||
2025-11-28 10:10:50.753 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - driverClassName................................"com.mysql.jdbc.Driver"
|
||||
2025-11-28 10:10:50.754 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - exceptionOverrideClassName................................none
|
||||
2025-11-28 10:10:50.755 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties................................{}
|
||||
2025-11-28 10:10:50.755 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry................................none
|
||||
2025-11-28 10:10:50.756 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout................................600000
|
||||
2025-11-28 10:10:50.756 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout................................1
|
||||
2025-11-28 10:10:50.757 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries................................false
|
||||
2025-11-28 10:10:50.757 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - jdbcUrl................................jdbc:mysql://rm-wz9n28sq10rz5b0u2o.mysql.rds.aliyuncs.com:3306/shareddata?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
2025-11-28 10:10:50.757 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - keepaliveTime................................0
|
||||
2025-11-28 10:10:50.758 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - leakDetectionThreshold................................0
|
||||
2025-11-28 10:10:50.758 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - maxLifetime................................1800000
|
||||
2025-11-28 10:10:50.758 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - maximumPoolSize................................10
|
||||
2025-11-28 10:10:50.758 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - metricRegistry................................none
|
||||
2025-11-28 10:10:50.759 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - metricsTrackerFactory................................none
|
||||
2025-11-28 10:10:50.760 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - minimumIdle................................10
|
||||
2025-11-28 10:10:50.760 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - password................................<masked>
|
||||
2025-11-28 10:10:50.761 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - poolName................................"HikariPool-1"
|
||||
2025-11-28 10:10:50.761 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - readOnly................................false
|
||||
2025-11-28 10:10:50.762 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - registerMbeans................................false
|
||||
2025-11-28 10:10:50.764 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - scheduledExecutor................................none
|
||||
2025-11-28 10:10:50.765 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - schema................................none
|
||||
2025-11-28 10:10:50.765 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - threadFactory................................internal
|
||||
2025-11-28 10:10:50.766 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - transactionIsolation................................default
|
||||
2025-11-28 10:10:50.766 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - username................................"shareddata"
|
||||
2025-11-28 10:10:50.766 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - validationTimeout................................5000
|
||||
2025-11-28 10:10:50.783 [pool-3-thread-1] DEBUG com.zaxxer.hikari.util.DriverDataSource - Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
|
||||
2025-11-28 10:10:51.900 [pool-3-thread-1] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@6103b528
|
||||
2025-11-28 10:10:51.956 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:10:52.011 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=1, active=1, idle=0, waiting=0)
|
||||
2025-11-28 10:10:52.143 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:10:52.326 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1fc4a273
|
||||
2025-11-28 10:10:52.335 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:10:52.623 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@6bd6d40c
|
||||
2025-11-28 10:10:52.915 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1f06a431
|
||||
2025-11-28 10:10:53.209 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@3ea70ef8
|
||||
2025-11-28 10:10:53.496 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@a531e5c
|
||||
2025-11-28 10:10:53.767 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@5830594f
|
||||
2025-11-28 10:10:54.036 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@7b5af629
|
||||
2025-11-28 10:10:54.333 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@155bb00f
|
||||
2025-11-28 10:10:54.615 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1ce8bf37
|
||||
2025-11-28 10:10:54.615 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - After adding stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:11:20.269 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:11:20.270 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:11:20.296 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:11:22.013 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:11:22.013 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:11:50.272 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:11:50.273 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:11:50.299 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:11:52.015 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:11:52.016 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:12:20.275 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:12:20.276 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:12:20.304 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:12:22.018 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:12:22.019 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:12:50.264 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:12:50.265 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:12:50.291 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:12:52.020 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:12:52.021 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:13:20.261 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:13:20.262 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:13:20.300 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:13:22.022 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:13:22.023 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:13:50.307 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:13:50.317 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:13:50.348 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:13:52.025 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:13:52.027 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:14:20.257 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:14:20.259 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:14:20.286 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:14:22.029 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:14:22.030 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:14:50.263 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:14:50.265 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:14:50.298 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:14:52.032 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:14:52.032 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:15:20.263 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:15:20.264 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:15:20.297 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:15:22.035 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:15:22.038 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:15:50.262 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:15:50.263 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:15:50.295 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:15:52.048 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:15:52.049 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:16:20.266 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:16:20.266 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:16:20.306 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:16:22.050 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:16:22.053 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:16:50.261 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:16:50.262 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:16:50.288 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:16:52.054 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:16:52.054 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:17:20.281 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:17:20.282 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:17:20.341 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:17:22.056 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:17:22.057 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:17:50.266 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:17:50.267 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:17:50.294 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:17:52.059 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:17:52.059 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:18:20.341 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:18:20.361 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:18:20.401 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:18:22.062 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:18:22.063 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:18:50.268 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:18:50.270 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:18:50.298 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:18:52.064 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:18:52.064 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:20:39.861 [background-preinit] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider
|
||||
2025-11-28 10:20:39.877 [main] DEBUG com.whdc.TdwyApplication - Running with Spring Boot v2.7.1, Spring v5.3.21
|
||||
2025-11-28 10:20:44.023 [main] DEBUG com.zaxxer.hikari.HikariConfig - Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
|
||||
2025-11-28 10:20:46.818 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - HikariPool-1 - configuration:
|
||||
2025-11-28 10:20:46.822 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension................................false
|
||||
2025-11-28 10:20:46.823 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - autoCommit................................true
|
||||
2025-11-28 10:20:46.823 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - catalog................................none
|
||||
2025-11-28 10:20:46.823 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql................................none
|
||||
2025-11-28 10:20:46.824 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery................................none
|
||||
2025-11-28 10:20:46.824 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout................................30000
|
||||
2025-11-28 10:20:46.824 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSource................................none
|
||||
2025-11-28 10:20:46.824 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName................................none
|
||||
2025-11-28 10:20:46.824 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI................................none
|
||||
2025-11-28 10:20:46.825 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties................................{password=<masked>}
|
||||
2025-11-28 10:20:46.825 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - driverClassName................................"com.mysql.jdbc.Driver"
|
||||
2025-11-28 10:20:46.825 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - exceptionOverrideClassName................................none
|
||||
2025-11-28 10:20:46.826 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties................................{}
|
||||
2025-11-28 10:20:46.826 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry................................none
|
||||
2025-11-28 10:20:46.827 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout................................600000
|
||||
2025-11-28 10:20:46.828 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout................................1
|
||||
2025-11-28 10:20:46.829 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries................................false
|
||||
2025-11-28 10:20:46.829 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - jdbcUrl................................jdbc:mysql://rm-wz9n28sq10rz5b0u2o.mysql.rds.aliyuncs.com:3306/shareddata?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
2025-11-28 10:20:46.830 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - keepaliveTime................................0
|
||||
2025-11-28 10:20:46.830 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - leakDetectionThreshold................................0
|
||||
2025-11-28 10:20:46.830 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - maxLifetime................................1800000
|
||||
2025-11-28 10:20:46.830 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - maximumPoolSize................................10
|
||||
2025-11-28 10:20:46.831 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - metricRegistry................................none
|
||||
2025-11-28 10:20:46.831 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - metricsTrackerFactory................................none
|
||||
2025-11-28 10:20:46.831 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - minimumIdle................................10
|
||||
2025-11-28 10:20:46.831 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - password................................<masked>
|
||||
2025-11-28 10:20:46.832 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - poolName................................"HikariPool-1"
|
||||
2025-11-28 10:20:46.832 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - readOnly................................false
|
||||
2025-11-28 10:20:46.832 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - registerMbeans................................false
|
||||
2025-11-28 10:20:46.833 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - scheduledExecutor................................none
|
||||
2025-11-28 10:20:46.833 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - schema................................none
|
||||
2025-11-28 10:20:46.833 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - threadFactory................................internal
|
||||
2025-11-28 10:20:46.833 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - transactionIsolation................................default
|
||||
2025-11-28 10:20:46.834 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - username................................"shareddata"
|
||||
2025-11-28 10:20:46.835 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - validationTimeout................................5000
|
||||
2025-11-28 10:20:46.841 [pool-3-thread-1] DEBUG com.zaxxer.hikari.util.DriverDataSource - Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
|
||||
2025-11-28 10:20:47.292 [main] DEBUG reactor.util.Loggers - Using Slf4j logging framework
|
||||
2025-11-28 10:20:47.431 [pool-3-thread-1] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@5b08004
|
||||
2025-11-28 10:20:47.469 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:20:47.521 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:20:47.537 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=1, active=1, idle=0, waiting=0)
|
||||
2025-11-28 10:20:47.598 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:20:47.876 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@31df4900
|
||||
2025-11-28 10:20:48.159 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@70e2433b
|
||||
2025-11-28 10:20:48.419 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@41583685
|
||||
2025-11-28 10:20:48.696 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@10cdbc74
|
||||
2025-11-28 10:20:49.045 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@3d448ac6
|
||||
2025-11-28 10:20:49.563 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1483c000
|
||||
2025-11-28 10:20:49.863 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1d65d4b7
|
||||
2025-11-28 10:20:50.248 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@282f78e3
|
||||
2025-11-28 10:20:50.694 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@60797add
|
||||
2025-11-28 10:20:50.694 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - After adding stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:21:16.515 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:21:16.516 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:21:16.551 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:21:17.540 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:21:17.541 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:21:46.515 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:21:46.516 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:21:46.551 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:21:47.542 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:21:47.542 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:22:16.515 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:22:16.516 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:22:16.552 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:22:17.568 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:22:17.569 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:22:46.517 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:22:46.518 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:22:46.546 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:22:47.573 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:22:47.574 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:23:16.519 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:23:16.519 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:23:16.573 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:23:17.576 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:23:17.576 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:23:46.514 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:23:46.515 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:23:46.545 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:23:47.578 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:23:47.579 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:24:16.518 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:24:16.520 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:24:16.546 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:24:17.580 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:24:17.583 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:24:46.578 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:24:46.579 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:24:46.607 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:24:47.583 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:24:47.584 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:25:16.517 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:25:16.517 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:25:16.586 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:25:17.585 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:25:17.586 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:25:46.515 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:25:46.520 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:25:46.546 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:25:47.587 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:25:47.588 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:26:16.516 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:26:16.517 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:26:16.543 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:26:17.590 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:26:17.590 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:26:46.515 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:26:46.515 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:26:46.543 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:26:47.591 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:26:47.591 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:27:16.515 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:27:16.516 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:27:16.545 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:27:17.593 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:27:17.593 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:27:46.523 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:27:46.525 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:27:46.553 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:27:47.594 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:27:47.594 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:56:09.786 [background-preinit] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider
|
||||
2025-11-28 10:56:09.794 [main] DEBUG com.whdc.TdwyApplication - Running with Spring Boot v2.7.1, Spring v5.3.21
|
||||
2025-11-28 10:56:13.482 [main] DEBUG com.zaxxer.hikari.HikariConfig - Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
|
||||
2025-11-28 10:56:15.872 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - HikariPool-1 - configuration:
|
||||
2025-11-28 10:56:15.875 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension................................false
|
||||
2025-11-28 10:56:15.876 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - autoCommit................................true
|
||||
2025-11-28 10:56:15.876 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - catalog................................none
|
||||
2025-11-28 10:56:15.876 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql................................none
|
||||
2025-11-28 10:56:15.877 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery................................none
|
||||
2025-11-28 10:56:15.877 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout................................30000
|
||||
2025-11-28 10:56:15.877 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSource................................none
|
||||
2025-11-28 10:56:15.877 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName................................none
|
||||
2025-11-28 10:56:15.877 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI................................none
|
||||
2025-11-28 10:56:15.878 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties................................{password=<masked>}
|
||||
2025-11-28 10:56:15.878 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - driverClassName................................"com.mysql.jdbc.Driver"
|
||||
2025-11-28 10:56:15.878 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - exceptionOverrideClassName................................none
|
||||
2025-11-28 10:56:15.879 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties................................{}
|
||||
2025-11-28 10:56:15.879 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry................................none
|
||||
2025-11-28 10:56:15.879 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout................................600000
|
||||
2025-11-28 10:56:15.880 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout................................1
|
||||
2025-11-28 10:56:15.880 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries................................false
|
||||
2025-11-28 10:56:15.881 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - jdbcUrl................................jdbc:mysql://rm-wz9n28sq10rz5b0u2o.mysql.rds.aliyuncs.com:3306/shareddata?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
2025-11-28 10:56:15.881 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - keepaliveTime................................0
|
||||
2025-11-28 10:56:15.881 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - leakDetectionThreshold................................0
|
||||
2025-11-28 10:56:15.882 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - maxLifetime................................1800000
|
||||
2025-11-28 10:56:15.882 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - maximumPoolSize................................10
|
||||
2025-11-28 10:56:15.882 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - metricRegistry................................none
|
||||
2025-11-28 10:56:15.882 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - metricsTrackerFactory................................none
|
||||
2025-11-28 10:56:15.883 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - minimumIdle................................10
|
||||
2025-11-28 10:56:15.883 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - password................................<masked>
|
||||
2025-11-28 10:56:15.883 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - poolName................................"HikariPool-1"
|
||||
2025-11-28 10:56:15.883 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - readOnly................................false
|
||||
2025-11-28 10:56:15.885 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - registerMbeans................................false
|
||||
2025-11-28 10:56:15.885 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - scheduledExecutor................................none
|
||||
2025-11-28 10:56:15.886 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - schema................................none
|
||||
2025-11-28 10:56:15.886 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - threadFactory................................internal
|
||||
2025-11-28 10:56:15.887 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - transactionIsolation................................default
|
||||
2025-11-28 10:56:15.887 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - username................................"shareddata"
|
||||
2025-11-28 10:56:15.887 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - validationTimeout................................5000
|
||||
2025-11-28 10:56:15.892 [pool-3-thread-1] DEBUG com.zaxxer.hikari.util.DriverDataSource - Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
|
||||
2025-11-28 10:56:16.377 [main] DEBUG reactor.util.Loggers - Using Slf4j logging framework
|
||||
2025-11-28 10:56:16.518 [pool-3-thread-1] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@49232ddd
|
||||
2025-11-28 10:56:16.534 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:56:16.569 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:56:16.623 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=1, active=1, idle=0, waiting=0)
|
||||
2025-11-28 10:56:16.654 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:56:16.890 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@75eb1159
|
||||
2025-11-28 10:56:17.188 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@34d61b62
|
||||
2025-11-28 10:56:17.463 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@5a88eb8
|
||||
2025-11-28 10:56:17.765 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@54f9e42d
|
||||
2025-11-28 10:56:18.074 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1c9198d2
|
||||
2025-11-28 10:56:18.352 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@50b75c7d
|
||||
2025-11-28 10:56:18.662 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1edec2a7
|
||||
2025-11-28 10:56:18.938 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@4aef49a8
|
||||
2025-11-28 10:56:19.241 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@36355b1b
|
||||
2025-11-28 10:56:19.241 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - After adding stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:56:45.769 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:56:45.770 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:56:45.810 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:56:46.626 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:56:46.627 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:57:15.766 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:57:15.767 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:57:15.794 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:57:16.628 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:57:16.628 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:57:45.792 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:57:45.795 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:57:46.091 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:57:46.629 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:57:46.629 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:58:16.788 [background-preinit] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider
|
||||
2025-11-28 10:58:16.811 [main] DEBUG com.whdc.TdwyApplication - Running with Spring Boot v2.7.1, Spring v5.3.21
|
||||
2025-11-28 10:58:21.741 [main] DEBUG com.zaxxer.hikari.HikariConfig - Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
|
||||
2025-11-28 10:58:25.094 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - HikariPool-1 - configuration:
|
||||
2025-11-28 10:58:25.099 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension................................false
|
||||
2025-11-28 10:58:25.101 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - autoCommit................................true
|
||||
2025-11-28 10:58:25.101 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - catalog................................none
|
||||
2025-11-28 10:58:25.102 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql................................none
|
||||
2025-11-28 10:58:25.103 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery................................none
|
||||
2025-11-28 10:58:25.103 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout................................30000
|
||||
2025-11-28 10:58:25.104 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSource................................none
|
||||
2025-11-28 10:58:25.104 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName................................none
|
||||
2025-11-28 10:58:25.104 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI................................none
|
||||
2025-11-28 10:58:25.105 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties................................{password=<masked>}
|
||||
2025-11-28 10:58:25.105 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - driverClassName................................"com.mysql.jdbc.Driver"
|
||||
2025-11-28 10:58:25.106 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - exceptionOverrideClassName................................none
|
||||
2025-11-28 10:58:25.106 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties................................{}
|
||||
2025-11-28 10:58:25.106 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry................................none
|
||||
2025-11-28 10:58:25.106 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout................................600000
|
||||
2025-11-28 10:58:25.107 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout................................1
|
||||
2025-11-28 10:58:25.108 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries................................false
|
||||
2025-11-28 10:58:25.108 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - jdbcUrl................................jdbc:mysql://rm-wz9n28sq10rz5b0u2o.mysql.rds.aliyuncs.com:3306/shareddata?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
2025-11-28 10:58:25.108 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - keepaliveTime................................0
|
||||
2025-11-28 10:58:25.109 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - leakDetectionThreshold................................0
|
||||
2025-11-28 10:58:25.109 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - maxLifetime................................1800000
|
||||
2025-11-28 10:58:25.109 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - maximumPoolSize................................10
|
||||
2025-11-28 10:58:25.109 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - metricRegistry................................none
|
||||
2025-11-28 10:58:25.109 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - metricsTrackerFactory................................none
|
||||
2025-11-28 10:58:25.110 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - minimumIdle................................10
|
||||
2025-11-28 10:58:25.110 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - password................................<masked>
|
||||
2025-11-28 10:58:25.110 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - poolName................................"HikariPool-1"
|
||||
2025-11-28 10:58:25.112 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - readOnly................................false
|
||||
2025-11-28 10:58:25.113 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - registerMbeans................................false
|
||||
2025-11-28 10:58:25.113 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - scheduledExecutor................................none
|
||||
2025-11-28 10:58:25.113 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - schema................................none
|
||||
2025-11-28 10:58:25.115 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - threadFactory................................internal
|
||||
2025-11-28 10:58:25.115 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - transactionIsolation................................default
|
||||
2025-11-28 10:58:25.116 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - username................................"shareddata"
|
||||
2025-11-28 10:58:25.116 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - validationTimeout................................5000
|
||||
2025-11-28 10:58:25.130 [pool-3-thread-1] DEBUG com.zaxxer.hikari.util.DriverDataSource - Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
|
||||
2025-11-28 10:58:26.191 [pool-3-thread-1] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@6f047266
|
||||
2025-11-28 10:58:26.248 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:58:26.305 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=1, active=1, idle=0, waiting=0)
|
||||
2025-11-28 10:58:26.483 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:58:26.606 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@3d0cca9e
|
||||
2025-11-28 10:58:26.757 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:58:26.877 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@49bcca10
|
||||
2025-11-28 10:58:27.161 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@4924b53b
|
||||
2025-11-28 10:58:27.451 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1c6fd08c
|
||||
2025-11-28 10:58:27.721 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@7beef54a
|
||||
2025-11-28 10:58:27.982 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1bc5b8e6
|
||||
2025-11-28 10:58:28.241 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@7541209f
|
||||
2025-11-28 10:58:28.527 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@66bea069
|
||||
2025-11-28 10:58:28.796 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@7b5f9fbf
|
||||
2025-11-28 10:58:28.797 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - After adding stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:58:57.347 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:58:57.348 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 10:59:01.663 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:59:14.692 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:59:16.073 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:59:24.688 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 10:59:24.690 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 10:59:24.718 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 10:59:27.350 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 10:59:27.351 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:06:04.670 [background-preinit] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Log4j2LoggerProvider
|
||||
2025-11-28 11:06:04.696 [main] DEBUG com.whdc.TdwyApplication - Running with Spring Boot v2.7.1, Spring v5.3.21
|
||||
2025-11-28 11:06:10.083 [main] DEBUG com.zaxxer.hikari.HikariConfig - Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
|
||||
2025-11-28 11:06:13.289 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - HikariPool-1 - configuration:
|
||||
2025-11-28 11:06:13.295 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension................................false
|
||||
2025-11-28 11:06:13.295 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - autoCommit................................true
|
||||
2025-11-28 11:06:13.296 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - catalog................................none
|
||||
2025-11-28 11:06:13.296 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql................................none
|
||||
2025-11-28 11:06:13.296 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery................................none
|
||||
2025-11-28 11:06:13.297 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout................................30000
|
||||
2025-11-28 11:06:13.297 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSource................................none
|
||||
2025-11-28 11:06:13.297 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName................................none
|
||||
2025-11-28 11:06:13.297 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI................................none
|
||||
2025-11-28 11:06:13.298 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties................................{password=<masked>}
|
||||
2025-11-28 11:06:13.298 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - driverClassName................................"com.mysql.jdbc.Driver"
|
||||
2025-11-28 11:06:13.299 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - exceptionOverrideClassName................................none
|
||||
2025-11-28 11:06:13.299 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties................................{}
|
||||
2025-11-28 11:06:13.299 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry................................none
|
||||
2025-11-28 11:06:13.299 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout................................600000
|
||||
2025-11-28 11:06:13.299 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout................................1
|
||||
2025-11-28 11:06:13.300 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries................................false
|
||||
2025-11-28 11:06:13.300 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - jdbcUrl................................jdbc:mysql://rm-wz9n28sq10rz5b0u2o.mysql.rds.aliyuncs.com:3306/shareddata?characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull&useInformationSchema=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||
2025-11-28 11:06:13.301 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - keepaliveTime................................0
|
||||
2025-11-28 11:06:13.301 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - leakDetectionThreshold................................0
|
||||
2025-11-28 11:06:13.301 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - maxLifetime................................1800000
|
||||
2025-11-28 11:06:13.301 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - maximumPoolSize................................10
|
||||
2025-11-28 11:06:13.301 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - metricRegistry................................none
|
||||
2025-11-28 11:06:13.302 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - metricsTrackerFactory................................none
|
||||
2025-11-28 11:06:13.302 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - minimumIdle................................10
|
||||
2025-11-28 11:06:13.302 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - password................................<masked>
|
||||
2025-11-28 11:06:13.303 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - poolName................................"HikariPool-1"
|
||||
2025-11-28 11:06:13.303 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - readOnly................................false
|
||||
2025-11-28 11:06:13.304 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - registerMbeans................................false
|
||||
2025-11-28 11:06:13.304 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - scheduledExecutor................................none
|
||||
2025-11-28 11:06:13.304 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - schema................................none
|
||||
2025-11-28 11:06:13.304 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - threadFactory................................internal
|
||||
2025-11-28 11:06:13.305 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - transactionIsolation................................default
|
||||
2025-11-28 11:06:13.305 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - username................................"shareddata"
|
||||
2025-11-28 11:06:13.305 [pool-3-thread-1] DEBUG com.zaxxer.hikari.HikariConfig - validationTimeout................................5000
|
||||
2025-11-28 11:06:13.316 [pool-3-thread-1] DEBUG com.zaxxer.hikari.util.DriverDataSource - Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
|
||||
2025-11-28 11:06:14.369 [pool-3-thread-1] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@7847e496
|
||||
2025-11-28 11:06:14.425 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:06:14.486 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=1, active=1, idle=0, waiting=0)
|
||||
2025-11-28 11:06:14.635 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:06:14.805 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:06:14.826 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@35205eca
|
||||
2025-11-28 11:06:15.115 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@419873f1
|
||||
2025-11-28 11:06:15.400 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@54a210d5
|
||||
2025-11-28 11:06:15.691 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@144345f1
|
||||
2025-11-28 11:06:15.952 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@3853ae9a
|
||||
2025-11-28 11:06:16.228 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@3ace5bb2
|
||||
2025-11-28 11:06:16.492 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@4eea9431
|
||||
2025-11-28 11:06:16.771 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@4d5f1343
|
||||
2025-11-28 11:06:17.090 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@58c50e77
|
||||
2025-11-28 11:06:17.091 [HikariPool-1 connection adder] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - After adding stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:06:42.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:06:42.911 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:06:42.941 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:06:44.486 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:06:44.486 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:07:12.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:07:12.911 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:07:12.940 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:07:14.488 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:07:14.489 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:07:42.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:07:42.911 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:07:42.936 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:07:44.491 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:07:44.492 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:08:12.907 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:08:12.908 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:08:12.935 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:08:14.493 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:08:14.494 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:08:42.915 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:08:42.916 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:08:42.944 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:08:44.495 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:08:44.496 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:09:12.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:09:12.912 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:09:12.940 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:09:14.498 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:09:14.499 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:09:42.908 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:09:42.909 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:09:42.940 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:09:44.501 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:09:44.502 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:10:12.908 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:10:12.909 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:10:12.939 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:10:14.503 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:10:14.504 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:10:42.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:10:42.911 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:10:42.942 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:10:44.505 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:10:44.506 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:11:12.909 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:11:12.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:11:12.938 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:11:14.506 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:11:14.506 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:11:42.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:11:42.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:11:42.938 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:11:44.508 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:11:44.508 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:12:12.915 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:12:12.915 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:12:12.944 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:12:14.511 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:12:14.511 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:12:42.920 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:12:42.921 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:12:42.948 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:12:44.512 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:12:44.512 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:13:12.953 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:13:12.954 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:13:12.981 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:13:14.514 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:13:14.514 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:13:42.958 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:13:42.967 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:13:43.014 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:13:44.515 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:13:44.517 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:14:12.914 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:14:12.917 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:14:12.944 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:14:14.519 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:14:14.521 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:14:42.911 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:14:42.913 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:14:42.939 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:14:44.523 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:14:44.523 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:15:12.915 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:15:12.920 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:15:12.947 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:15:14.526 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:15:14.526 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:15:42.911 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:15:42.912 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:15:42.940 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:15:44.527 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:15:44.528 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:16:12.916 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:16:12.917 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:16:12.947 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:16:14.529 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:16:14.530 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:16:42.923 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:16:42.924 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:16:42.950 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:16:44.530 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:16:44.530 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:17:12.912 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:17:12.913 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:17:12.941 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:17:14.550 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:17:14.556 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:17:42.912 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:17:42.913 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:17:42.941 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:17:44.557 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:17:44.558 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:18:12.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:18:12.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:18:12.939 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:18:14.560 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:18:14.561 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:18:42.909 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:18:42.910 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:18:42.937 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:18:44.562 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:18:44.562 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:19:12.909 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:19:12.909 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:19:12.936 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:19:14.564 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:19:14.564 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:19:42.911 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:19:42.912 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:19:42.939 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:19:44.585 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:19:44.600 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
2025-11-28 11:20:12.913 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Preparing: SELECT id,camera_name,camera_ip,username,password,port,channel_no,enabled,description,factory_id,local_port FROM camera_config WHERE (enabled = ?)
|
||||
2025-11-28 11:20:12.914 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - ==> Parameters: 1(Integer)
|
||||
2025-11-28 11:20:12.947 [pool-3-thread-1] DEBUG com.whdc.mapper.CameraConfigMapper.selectList - <== Total: 0
|
||||
2025-11-28 11:20:14.605 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
|
||||
2025-11-28 11:20:14.605 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool is at sufficient level.
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
2025-11-28 10:10:50.285 [main] ERROR com.github.jeffreyning.mybatisplus.conf.PlusConfig - mpp.entityBasePath is null skip scan result map
|
||||
2025-11-28 10:11:29.555 [http-nio-12120-exec-1] ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.ExceptionInInitializerError] with root cause
|
||||
java.lang.ClassCastException: com.sun.proxy.$Proxy105 cannot be cast to com.whdc.syncjava.NVSSDK3
|
||||
at com.whdc.syncjava.NetClient3.<clinit>(NetClient3.java:13)
|
||||
at com.whdc.service.impl.DeviceLoginService.initializeSDK(DeviceLoginService.java:136)
|
||||
at com.whdc.service.impl.DeviceLoginService.loginActiveDevice(DeviceLoginService.java:21)
|
||||
at com.whdc.controller.DeviceLoginController.loginActiveDevice(DeviceLoginController.java:22)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|
||||
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.lang.reflect.Method.invoke(Method.java:498)
|
||||
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
|
||||
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
|
||||
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
|
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
|
||||
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
|
||||
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
|
||||
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
|
||||
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
|
||||
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
|
||||
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
|
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
|
||||
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
|
||||
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
|
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
|
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
|
||||
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
|
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
|
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
|
||||
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
|
||||
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
|
||||
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
|
||||
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
|
||||
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
|
||||
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
|
||||
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
|
||||
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
|
||||
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
|
||||
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
|
||||
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
|
||||
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
|
||||
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
|
||||
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890)
|
||||
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1787)
|
||||
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
|
||||
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
|
||||
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
|
||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
|
||||
at java.lang.Thread.run(Thread.java:750)
|
||||
2025-11-28 10:20:46.510 [main] ERROR com.github.jeffreyning.mybatisplus.conf.PlusConfig - mpp.entityBasePath is null skip scan result map
|
||||
2025-11-28 10:56:15.764 [main] ERROR com.github.jeffreyning.mybatisplus.conf.PlusConfig - mpp.entityBasePath is null skip scan result map
|
||||
2025-11-28 10:58:24.709 [main] ERROR com.github.jeffreyning.mybatisplus.conf.PlusConfig - mpp.entityBasePath is null skip scan result map
|
||||
2025-11-28 11:06:12.930 [main] ERROR com.github.jeffreyning.mybatisplus.conf.PlusConfig - mpp.entityBasePath is null skip scan result map
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
2025-11-28 10:10:40.150 [main] INFO com.whdc.TdwyApplication - Starting TdwyApplication using Java 1.8.0_381 on DESKTOP-9RGDG2U with PID 24460 (C:\project\tdwy-service\target\classes started by gsiot in C:\project\tdwy-service)
|
||||
2025-11-28 10:10:40.168 [main] INFO com.whdc.TdwyApplication - No active profile set, falling back to 1 default profile: "default"
|
||||
2025-11-28 10:10:45.734 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat]
|
||||
2025-11-28 10:10:45.735 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.64]
|
||||
2025-11-28 10:10:46.440 [main] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
|
||||
2025-11-28 10:10:49.632 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:10:49.633 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:10:49.637 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:10:49.816 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:10:49.816 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:10:49.816 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:10:50.040 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:10:50.041 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:10:50.041 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:10:50.218 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK版本: 5.5.25.313
|
||||
2025-11-28 10:10:50.229 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK通知函数设置: -1
|
||||
2025-11-28 10:10:50.230 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK启动: -1
|
||||
2025-11-28 10:10:50.231 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - 多摄像头检测服务已启动
|
||||
2025-11-28 10:10:50.766 [pool-3-thread-1] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||
2025-11-28 10:10:51.909 [pool-3-thread-1] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
|
||||
2025-11-28 10:10:53.910 [main] INFO com.whdc.TdwyApplication - Started TdwyApplication in 15.727 seconds (JVM running for 20.665)
|
||||
2025-11-28 10:11:28.533 [http-nio-12120-exec-1] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
|
||||
2025-11-28 10:20:39.875 [main] INFO com.whdc.TdwyApplication - Starting TdwyApplication using Java 1.8.0_381 on DESKTOP-9RGDG2U with PID 20548 (C:\project\tdwy-service\target\classes started by gsiot in C:\project\tdwy-service)
|
||||
2025-11-28 10:20:39.878 [main] INFO com.whdc.TdwyApplication - No active profile set, falling back to 1 default profile: "default"
|
||||
2025-11-28 10:20:43.235 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat]
|
||||
2025-11-28 10:20:43.236 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.64]
|
||||
2025-11-28 10:20:43.855 [main] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
|
||||
2025-11-28 10:20:46.073 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:20:46.074 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:20:46.074 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:20:46.234 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:20:46.234 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:20:46.235 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:20:46.407 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:20:46.408 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:20:46.408 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:20:46.476 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK版本: 5.5.25.313
|
||||
2025-11-28 10:20:46.483 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK通知函数设置: -1
|
||||
2025-11-28 10:20:46.485 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK启动: -1
|
||||
2025-11-28 10:20:46.486 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - 多摄像头检测服务已启动
|
||||
2025-11-28 10:20:46.835 [pool-3-thread-1] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||
2025-11-28 10:20:47.436 [pool-3-thread-1] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
|
||||
2025-11-28 10:20:48.183 [main] INFO com.whdc.TdwyApplication - Started TdwyApplication in 9.501 seconds (JVM running for 12.067)
|
||||
2025-11-28 10:21:10.229 [http-nio-12120-exec-1] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
|
||||
2025-11-28 10:56:09.785 [main] INFO com.whdc.TdwyApplication - Starting TdwyApplication using Java 1.8.0_381 on DESKTOP-9RGDG2U with PID 27472 (C:\project\tdwy-service\target\classes started by gsiot in C:\project\tdwy-service)
|
||||
2025-11-28 10:56:09.795 [main] INFO com.whdc.TdwyApplication - No active profile set, falling back to 1 default profile: "default"
|
||||
2025-11-28 10:56:12.780 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat]
|
||||
2025-11-28 10:56:12.781 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.64]
|
||||
2025-11-28 10:56:13.295 [main] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
|
||||
2025-11-28 10:56:15.479 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:56:15.480 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:56:15.481 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:56:15.579 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:56:15.579 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:56:15.579 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:56:15.684 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:56:15.685 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:56:15.685 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:56:15.725 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK版本: 5.5.25.313
|
||||
2025-11-28 10:56:15.733 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK通知函数设置: -1
|
||||
2025-11-28 10:56:15.734 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK启动: -1
|
||||
2025-11-28 10:56:15.736 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - 多摄像头检测服务已启动
|
||||
2025-11-28 10:56:15.888 [pool-3-thread-1] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||
2025-11-28 10:56:16.521 [pool-3-thread-1] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
|
||||
2025-11-28 10:56:16.989 [main] INFO com.whdc.TdwyApplication - Started TdwyApplication in 8.332 seconds (JVM running for 10.577)
|
||||
2025-11-28 10:56:49.391 [http-nio-12120-exec-1] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
|
||||
2025-11-28 10:58:16.809 [main] INFO com.whdc.TdwyApplication - Starting TdwyApplication using Java 1.8.0_381 on DESKTOP-9RGDG2U with PID 25384 (C:\project\tdwy-service\target\classes started by gsiot in C:\project\tdwy-service)
|
||||
2025-11-28 10:58:16.812 [main] INFO com.whdc.TdwyApplication - No active profile set, falling back to 1 default profile: "default"
|
||||
2025-11-28 10:58:20.700 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat]
|
||||
2025-11-28 10:58:20.701 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.64]
|
||||
2025-11-28 10:58:21.382 [main] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
|
||||
2025-11-28 10:58:24.002 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:58:24.003 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:58:24.003 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 10:58:24.312 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:58:24.312 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:58:24.312 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 10:58:24.475 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:58:24.476 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:58:24.479 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 10:58:24.643 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK版本: 5.5.25.313
|
||||
2025-11-28 10:58:24.653 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK通知函数设置: -1
|
||||
2025-11-28 10:58:24.655 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK启动: -1
|
||||
2025-11-28 10:58:24.656 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - 多摄像头检测服务已启动
|
||||
2025-11-28 10:58:25.116 [pool-3-thread-1] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||
2025-11-28 10:58:26.203 [pool-3-thread-1] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
|
||||
2025-11-28 10:58:28.235 [main] INFO com.whdc.TdwyApplication - Started TdwyApplication in 13.048 seconds (JVM running for 16.423)
|
||||
2025-11-28 10:58:40.516 [http-nio-12120-exec-2] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
|
||||
2025-11-28 11:06:04.694 [main] INFO com.whdc.TdwyApplication - Starting TdwyApplication using Java 1.8.0_381 on DESKTOP-9RGDG2U with PID 26220 (C:\project\tdwy-service\target\classes started by gsiot in C:\project\tdwy-service)
|
||||
2025-11-28 11:06:04.699 [main] INFO com.whdc.TdwyApplication - No active profile set, falling back to 1 default profile: "default"
|
||||
2025-11-28 11:06:09.147 [main] INFO org.apache.catalina.core.StandardService - Starting service [Tomcat]
|
||||
2025-11-28 11:06:09.148 [main] INFO org.apache.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.64]
|
||||
2025-11-28 11:06:09.812 [main] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
|
||||
2025-11-28 11:06:12.362 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 11:06:12.363 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 11:06:12.363 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.AlarmRecord not contain MppMultiId anno
|
||||
2025-11-28 11:06:12.528 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 11:06:12.528 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 11:06:12.528 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.User not contain MppMultiId anno
|
||||
2025-11-28 11:06:12.723 [main] INFO c.g.j.mybatisplus.base.SelectByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 11:06:12.723 [main] INFO c.g.j.mybatisplus.base.UpdateByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 11:06:12.724 [main] INFO c.g.j.mybatisplus.base.DeleteByMultiIdMethod - entity com.whdc.entity.CameraConfig not contain MppMultiId anno
|
||||
2025-11-28 11:06:12.870 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK版本: 5.5.25.313
|
||||
2025-11-28 11:06:12.879 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK通知函数设置: -1
|
||||
2025-11-28 11:06:12.880 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - SDK启动: -1
|
||||
2025-11-28 11:06:12.881 [main] INFO com.whdc.service.impl.MultiCameraDetectionService - 多摄像头检测服务已启动
|
||||
2025-11-28 11:06:13.305 [pool-3-thread-1] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
|
||||
2025-11-28 11:06:14.379 [pool-3-thread-1] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
|
||||
2025-11-28 11:06:16.133 [main] INFO com.whdc.TdwyApplication - Started TdwyApplication in 12.979 seconds (JVM running for 16.175)
|
||||
2025-11-28 11:06:26.842 [http-nio-12120-exec-2] INFO o.a.c.core.ContainerBase.[Tomcat].[localhost].[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
2025-11-28 10:10:50.776 [pool-3-thread-1] WARN com.zaxxer.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
|
||||
2025-11-28 10:20:46.838 [pool-3-thread-1] WARN com.zaxxer.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
|
||||
2025-11-28 10:56:15.891 [pool-3-thread-1] WARN com.zaxxer.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
|
||||
2025-11-28 10:58:25.128 [pool-3-thread-1] WARN com.zaxxer.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
|
||||
2025-11-28 11:06:13.315 [pool-3-thread-1] WARN com.zaxxer.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
|
||||
65
pom.xml
65
pom.xml
|
|
@ -12,9 +12,9 @@
|
|||
</parent>
|
||||
|
||||
<groupId>com.whdc</groupId>
|
||||
<artifactId>yjt-service</artifactId>
|
||||
<artifactId>tdwy-service</artifactId>
|
||||
<version>1.0</version>
|
||||
<description>颜家台</description>
|
||||
<description>视频</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
|
@ -97,6 +97,51 @@
|
|||
<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>
|
||||
<!-- Spring WebSocket -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Jakarta WebSocket API -->
|
||||
<dependency>
|
||||
<groupId>jakarta.websocket</groupId>
|
||||
<artifactId>jakarta.websocket-api</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
|
@ -107,7 +152,7 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>com.whdc.YjtApplication</mainClass>
|
||||
<mainClass>com.whdc.TdwyApplication</mainClass>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
|
@ -118,6 +163,19 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<!-- 添加资源拷贝配置 -->
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>lib</directory>
|
||||
<targetPath>BOOT-INF/lib/</targetPath>
|
||||
<includes>
|
||||
<include>*.jar</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
<!-- <build>-->
|
||||
<!-- <plugins>-->
|
||||
|
|
@ -185,4 +243,5 @@
|
|||
<!-- </plugin>-->
|
||||
<!-- </plugins>-->
|
||||
<!-- </build>-->
|
||||
|
||||
</project>
|
||||
|
|
@ -19,12 +19,12 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.whdc.mapper")
|
||||
public class YjtApplication {
|
||||
public class TdwyApplication {
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>> 启动程序 <<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||
|
||||
SpringApplication.run(YjtApplication.class, args);
|
||||
SpringApplication.run(TdwyApplication.class, args);
|
||||
} catch (BeansException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
|
|
@ -0,0 +1,413 @@
|
|||
package com.whdc.alarm;
|
||||
|
||||
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.Scanner;
|
||||
|
||||
|
||||
public class ItsSnap {
|
||||
|
||||
int m_iLogonID = -1;
|
||||
int m_iConnectID = -1;
|
||||
|
||||
String[] strCarPlateColor = new String[NVSSDK2.MAX_CAR_PLATE_COLOR];
|
||||
String[] strCarColor = new String[NVSSDK2.MAX_CAR_COLOR];
|
||||
|
||||
int iCount = 0;
|
||||
|
||||
NVSSDK2.MAIN_NOTIFY cbkMain = new NVSSDK2.MAIN_NOTIFY()
|
||||
{
|
||||
public void MainNotify(int iLogonID, int wParam, Pointer lParam,
|
||||
Pointer noitfyUserData) {
|
||||
|
||||
int iMsgType = wParam & 0xFFFF;
|
||||
switch (iMsgType) {
|
||||
case NVSSDK2.WCM_LOGON_NOTIFY:
|
||||
{
|
||||
try
|
||||
{
|
||||
int iLogonStatus = NetClient2.GetLogonStatus(iLogonID);
|
||||
NVSSDK2.ENCODERINFO tDevInfo = new NVSSDK2.ENCODERINFO();
|
||||
NetClient2.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;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void LogonNotify(String strIP, String strID, int iLogonID,
|
||||
int iLogonState) {
|
||||
String strMsg = new String();
|
||||
m_iLogonID = -1;
|
||||
switch (iLogonState) {
|
||||
case NVSSDK2.LOGON_SUCCESS: {
|
||||
m_iLogonID = iLogonID;
|
||||
strMsg = "LOGON_SUCCESS";
|
||||
break;
|
||||
}
|
||||
case NVSSDK2.LOGON_FAILED: {
|
||||
strMsg = "LOGON_FAILED";
|
||||
break;
|
||||
}
|
||||
case NVSSDK2.LOGON_TIMEOUT: {
|
||||
strMsg = "LOGON_TIMEOUT";
|
||||
break;
|
||||
}
|
||||
case NVSSDK2.LOGON_RETRY: {
|
||||
strMsg = "LOGON_RETRY";
|
||||
break;
|
||||
}
|
||||
case NVSSDK2.LOGON_ING: {
|
||||
strMsg = "LOGON_ING";
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
System.out.println("[WCM_LOGON_NOTIFY][" + iLogonState + "] IP("
|
||||
+ strIP + "),ID(" + strID + "),LogonID(" + iLogonID + ")");
|
||||
}
|
||||
}
|
||||
System.out.println("[WCM_LOGON_NOTIFY][" + strMsg + "] IP(" + strIP
|
||||
+ "),ID(" + strID + "),LogonID(" + iLogonID + ")");
|
||||
}
|
||||
|
||||
NVSSDK2.ALARM_NOTIFY cbkAlarm = new NVSSDK2.ALARM_NOTIFY(){
|
||||
public void AlarmNotify(int _iLogonID, int _iChannel,
|
||||
int _iAlarmState, int _iAlarmType, Pointer _pUserData) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
NVSSDK2.PARACHANGE_NOTIFY cbkParaChange = new NVSSDK2.PARACHANGE_NOTIFY(){
|
||||
public void ParaChangeNotify(int iLogonID, int iChannel, int paraType,
|
||||
Pointer para, Pointer noitfyUserData) {
|
||||
}
|
||||
};
|
||||
NVSSDK2.RECVDATA_NOTIFY cbkRecvData = new NVSSDK2.RECVDATA_NOTIFY(){
|
||||
public void RecvDataNotify(int _ulID, Pointer data, int len, int _iFlag,
|
||||
Pointer _lpUserData) {
|
||||
System.out.println("[RECVDATA_NOTIFY] ConnID(" + _ulID + "),DataLen("
|
||||
+ len + ")");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private int SDKInit() {
|
||||
NVSSDK2.SDK_VERSION ver = new NVSSDK2.SDK_VERSION();
|
||||
int iRet = NetClient2.GetVersion(ver);
|
||||
System.out.println("[SDK_VERSION]" + ver.m_cVerInfo);
|
||||
|
||||
iRet = NetClient2.SetNotifyFunction(cbkMain, cbkAlarm, cbkParaChange);
|
||||
System.out.println("SetNotifyFunction(" + iRet + ")");
|
||||
|
||||
iRet = NetClient2.Startup();
|
||||
System.out.println("Startup(" + iRet + ")");
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
public int LogonDevice()
|
||||
{
|
||||
Scanner scanIn = new Scanner(System.in);
|
||||
System.out.print("IP:" );
|
||||
String strIP = scanIn.next();
|
||||
System.out.print("UserName:" );
|
||||
String strUserName = scanIn.next();
|
||||
System.out.print("Password:" );
|
||||
String strPasswd = scanIn.next();
|
||||
System.out.print("Port:" );
|
||||
int iPort = 3000;
|
||||
|
||||
System.out.println("Logon" + strIP + ":" + 3000 + "-" +strUserName + "-" + strPasswd);
|
||||
while(true){
|
||||
m_iLogonID = NetClient2.Logon("", strIP, strUserName, strPasswd, "",iPort);
|
||||
int iLogonStatus = NetClient2.GetLogonStatus(m_iLogonID);
|
||||
if(iLogonStatus == NVSSDK2.LOGON_SUCCESS){
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.currentThread();
|
||||
Thread.sleep(1000);
|
||||
} catch(InterruptedException e) {
|
||||
System.err.println("Interrupted");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
public boolean createDir(String destDirName) {
|
||||
File dir = new File(destDirName);
|
||||
if (dir.exists()) {// Check if a directory exists
|
||||
System.out.println("Failed to create directory, target directory already exists!");
|
||||
return false;
|
||||
}
|
||||
if (!destDirName.endsWith(File.separator)) {// Whether it ends with "/"
|
||||
destDirName = destDirName + File.separator;
|
||||
}
|
||||
if (dir.mkdirs()) {//Create target directory
|
||||
System.out.println("Create directory successfully!" + destDirName);
|
||||
return true;
|
||||
} else {
|
||||
System.out.println("Failed to create directory!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int SavePic(String FileName, Pointer pic, int len)
|
||||
{
|
||||
FileOutputStream fop = null;
|
||||
File file;
|
||||
|
||||
try {
|
||||
|
||||
|
||||
file = new File(FileName);
|
||||
fop = new FileOutputStream(file);
|
||||
|
||||
// if file doesnt exists, then create it
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
|
||||
// get the content in bytes
|
||||
byte[] contentInBytes = pic.getByteArray(0, len);
|
||||
|
||||
fop.write(contentInBytes);
|
||||
fop.flush();
|
||||
fop.close();
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (fop != null) {
|
||||
fop.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
NVSSDK2.NET_PICSTREAM_NOTIFY cbkPicData = new NVSSDK2.NET_PICSTREAM_NOTIFY(){
|
||||
public int PicDataNotify(int _ulID, int _lCommand, Pointer _tInfo, int _iLen,
|
||||
Pointer _lpUserData){
|
||||
|
||||
if(_lCommand != NVSSDK2.NET_PICSTREAM_CMD_ITS){
|
||||
System.out.println("PicDataNotify other Snap type " + _lCommand) ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
NVSSDK2.ItsPicStream tItsPicStream = new NVSSDK2.ItsPicStream();
|
||||
tItsPicStream.write();
|
||||
Pointer pItsBuffer = tItsPicStream.getPointer();
|
||||
byte[] RecvBuffer = _tInfo.getByteArray(0, _iLen);
|
||||
int iCopySize = Math.min(tItsPicStream.size(), _iLen);
|
||||
pItsBuffer.write(0, RecvBuffer, 0, iCopySize);
|
||||
tItsPicStream.read();
|
||||
String strIP = new String(tItsPicStream.cCameraIP).trim();
|
||||
String strPlate = new String(tItsPicStream.cPlate).trim();
|
||||
|
||||
String strOutput = "PicDataNotify Snap Pic "+strIP+
|
||||
" iChannelID: " + tItsPicStream.iChannelID+
|
||||
" count:"+ tItsPicStream.iPicCount +
|
||||
" cPlate:" + strPlate;
|
||||
if(tItsPicStream.iCarColor >= 0 && tItsPicStream.iCarColor < NVSSDK2.MAX_CAR_COLOR) {
|
||||
strOutput += " Car Color:" + strCarColor[tItsPicStream.iCarColor];
|
||||
} else {
|
||||
strOutput += " Car Color:" + "unknown ";
|
||||
}
|
||||
|
||||
if(tItsPicStream.iPlateColor >= 0 && tItsPicStream.iPlateColor < NVSSDK2.MAX_CAR_PLATE_COLOR) {
|
||||
strOutput += " Plate Color:" + strCarPlateColor[tItsPicStream.iPlateColor];
|
||||
} else {
|
||||
strOutput += " Plate Color:" + "unknown ";
|
||||
}
|
||||
|
||||
System.out.println(strOutput) ;
|
||||
|
||||
if(tItsPicStream.iPicCount <= 0){
|
||||
System.out.println("error count " + tItsPicStream.iPicCount) ;
|
||||
return -1;
|
||||
}
|
||||
|
||||
NVSSDK2.PicData[] tPicData = (NVSSDK2.PicData[])new NVSSDK2.PicData().toArray(8);
|
||||
for(int i = 0; i < tItsPicStream.iPicCount && i < 8; i++){
|
||||
tPicData[i].write();
|
||||
Pointer pPicBuffer = tPicData[i].getPointer();
|
||||
Pointer pData = tItsPicStream.tPicData[i];
|
||||
byte[] bBuffer = pData.getByteArray(0, tItsPicStream.iSize);
|
||||
int iPicSize = Math.min(tPicData[i].size(), tItsPicStream.iSize);
|
||||
pPicBuffer.write(0, bBuffer, 0, iPicSize);
|
||||
tPicData[i].read();
|
||||
}
|
||||
|
||||
int uiYear = tPicData[0].tPicTime.uiYear;
|
||||
int uiMonth = tPicData[0].tPicTime.uiMonth;
|
||||
int uiDay = tPicData[0].tPicTime.uiDay;
|
||||
int uiWeek = tPicData[0].tPicTime.uiWeek;
|
||||
int uiHour = tPicData[0].tPicTime.uiHour;
|
||||
int uiMinute = tPicData[0].tPicTime.uiMinute;
|
||||
int uiSecondsr = tPicData[0].tPicTime.uiSecondsr;
|
||||
int uiMilliseconds = tPicData[0].tPicTime.uiMilliseconds;
|
||||
|
||||
String strFileName = new String();
|
||||
strFileName +="ITS" + uiYear + "-"+ uiMonth + "-"+ uiDay + "-"+ uiWeek + "-"+ uiHour + "-"+ uiMinute+ "-"+ uiSecondsr + "-"+ uiMilliseconds;
|
||||
for(int i = 0; i < tItsPicStream.iPicCount && i < 8; i++){
|
||||
if(iCount > 2000)
|
||||
{
|
||||
System.out.println("save picture over 20000!") ;
|
||||
}
|
||||
SavePic("PIC/" + strFileName + "pic" + iCount + ".jpg", tPicData[i].pcPicData, tPicData[i].iDataLen);
|
||||
iCount++;
|
||||
}
|
||||
|
||||
NVSSDK2.PicData tPlatData = (NVSSDK2.PicData)new NVSSDK2.PicData();
|
||||
if(tItsPicStream.iPlatCount > 0) {
|
||||
tPlatData.write();
|
||||
Pointer pPicBuffer = tPlatData.getPointer();
|
||||
Pointer pData = tItsPicStream.tPlatData;
|
||||
byte[] bBuffer = pData.getByteArray(0, tItsPicStream.iSize);
|
||||
int iPicSize = Math.min(tPlatData.size(), tItsPicStream.iSize);
|
||||
pPicBuffer.write(0, bBuffer, 0, iPicSize);
|
||||
tPlatData.read();
|
||||
|
||||
SavePic("PIC/" + strFileName + "plat" + "CP" + ".jpg", tPlatData.pcPicData, tPlatData.iDataLen);
|
||||
}
|
||||
|
||||
NVSSDK2.PicData[] tFaceData = (NVSSDK2.PicData[])new NVSSDK2.PicData().toArray(3);
|
||||
for(int i = 0; i < tItsPicStream.iFaceCount && i < 8; i++){
|
||||
tFaceData[i].write();
|
||||
Pointer pPicBuffer = tFaceData[i].getPointer();
|
||||
Pointer pData = tItsPicStream.tPicData[i];
|
||||
byte[] bBuffer = pData.getByteArray(0, tItsPicStream.iSize);
|
||||
int iPicSize = Math.min(tFaceData[i].size(), tItsPicStream.iSize);
|
||||
pPicBuffer.write(0, bBuffer, 0, iPicSize);
|
||||
tFaceData[i].read();
|
||||
|
||||
SavePic("PIC/" + strFileName + "plat" + "RL" + + i + ".jpg", tFaceData[i].pcPicData, tFaceData[i].iDataLen);
|
||||
}
|
||||
|
||||
String strlog = "PicDataNotify Snap Pic" + "Pic" + tItsPicStream.iPicCount + "Plat" + tItsPicStream.iPlatCount + " Face" + tItsPicStream.iFaceCount;
|
||||
System.out.println(strlog) ;
|
||||
|
||||
String strBWPlateData = new String();
|
||||
if (tItsPicStream.pcBWPlateData != Pointer.NULL && tItsPicStream.iBWPlatePicLen > 0)
|
||||
{
|
||||
strBWPlateData = tItsPicStream.pcBWPlateData.getString(tItsPicStream.iBWPlatePicLen);
|
||||
}
|
||||
System.out.println("iPreset:" + tItsPicStream.iPreset + ",iArea:" + tItsPicStream.iArea + ",sOriginalImgWidth:" + tItsPicStream.sOriginalImgWidth
|
||||
+ ",pcBWPlateData:" + strBWPlateData + ",iRealImgWidth:" + tItsPicStream.iRealImgWidth + ",iRealImgHeight:" + tItsPicStream.iRealImgHeight
|
||||
+ ",iTargetType:" + tItsPicStream.iTargetType + ",iNewTargetType:" + tItsPicStream.iNewTargetType);
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
public int StartSnap()
|
||||
{
|
||||
NVSSDK2.NetPicPara tNetPicParam = new NVSSDK2.NetPicPara();
|
||||
tNetPicParam.iStructLen = tNetPicParam.size();
|
||||
tNetPicParam.iChannelNo = 0;
|
||||
tNetPicParam.cbkPicStreamNotify = cbkPicData; //Capture callback function
|
||||
tNetPicParam.pvUser = null;
|
||||
|
||||
IntByReference pConnectID = new IntByReference();
|
||||
int iRet = NetClient2.StartRecvNetPicStream(m_iLogonID, tNetPicParam, tNetPicParam.size(), pConnectID);
|
||||
if (iRet < 0) {
|
||||
m_iConnectID = -1;
|
||||
System.out.println("StartRecvNetPicStream Failed!");
|
||||
} else {
|
||||
m_iConnectID = pConnectID.getValue();
|
||||
System.out.println("StartRecvNetPicStream Success! ConnectID(" + m_iConnectID + ")");
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
public int InitValueString()
|
||||
{
|
||||
strCarPlateColor[0] = "unknown";
|
||||
strCarPlateColor[1] = "white on blue";
|
||||
strCarPlateColor[2] = "black on yellow";
|
||||
strCarPlateColor[3] = "Black on white";
|
||||
strCarPlateColor[4] = "black and white";
|
||||
strCarPlateColor[5] = "white on green";
|
||||
|
||||
strCarColor[0] = "white";
|
||||
strCarColor[1] = "red" ;
|
||||
strCarColor[2] = "yellow" ;
|
||||
strCarColor[3] = "yellow" ;
|
||||
strCarColor[4] = "blue" ;
|
||||
strCarColor[5] = "green" ;
|
||||
strCarColor[6] = "green" ;
|
||||
strCarColor[7] = "purple" ;
|
||||
strCarColor[8] = "pink" ;
|
||||
strCarColor[9] = "black" ;
|
||||
strCarColor[10] = "red" ;
|
||||
strCarColor[11] = "yellow" ;
|
||||
strCarColor[12] = "yellow" ;
|
||||
strCarColor[13] = "grey" ;
|
||||
strCarColor[14] = "yellow" ;
|
||||
strCarColor[15] = "blue" ;
|
||||
strCarColor[16] = "blue" ;
|
||||
strCarColor[17] = "green" ;
|
||||
strCarColor[18] = "green" ;
|
||||
strCarColor[19] = "white" ;
|
||||
strCarColor[20] = "green" ;
|
||||
strCarColor[21] = "cyan" ;
|
||||
strCarColor[22] = "yellow" ;
|
||||
strCarColor[23] = "red" ;
|
||||
strCarColor[24] = "blue" ;
|
||||
strCarColor[25] = "blue" ;
|
||||
strCarColor[26] = "grey" ;
|
||||
strCarColor[27] = "purple" ;
|
||||
strCarColor[28] = "purple" ;
|
||||
strCarColor[29] = "brown" ;
|
||||
strCarColor[30] = "brown" ;
|
||||
strCarColor[31] = "brown" ;
|
||||
return 0;
|
||||
};
|
||||
|
||||
public static void main(String args[])
|
||||
{
|
||||
ItsSnap tItsSnap = new ItsSnap();
|
||||
tItsSnap.createDir("PIC");//Create snapshot directory
|
||||
tItsSnap.InitValueString();
|
||||
tItsSnap.SDKInit(); //Initialize SDK
|
||||
tItsSnap.LogonDevice();//Log in to the device
|
||||
tItsSnap.StartSnap();//Connect image stream channel
|
||||
|
||||
while(true){
|
||||
try {
|
||||
Thread.currentThread();
|
||||
Thread.sleep(1000);
|
||||
} catch(InterruptedException e) {
|
||||
System.err.println("Interrupted");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,405 @@
|
|||
package com.whdc.alarm;
|
||||
|
||||
import com.sun.jna.Callback;
|
||||
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;
|
||||
|
||||
public interface NVSSDK2 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
|
||||
|
||||
public static final int MAX_CAR_COLOR = 32;
|
||||
public static final int MAX_CAR_PLATE_COLOR = 6;
|
||||
|
||||
public static final int LEN_32 = 32;
|
||||
public static final int LEN_64 = 64;
|
||||
public static final int LEN_16 = 16;
|
||||
public static final int LEN_8 = 8;
|
||||
public static final int LEN_36 = 36;
|
||||
public static final int LEN_128 = 128;
|
||||
|
||||
public static class RECT_S extends Structure implements ByValue {
|
||||
public short sLeft;
|
||||
public short sRight;
|
||||
public short sTop;
|
||||
public short sBottom;
|
||||
}
|
||||
|
||||
public static class STRCT_BRAND extends Structure
|
||||
{
|
||||
public int uiBrandType; //Vehicle Brands
|
||||
public int uiSubBrand; //Vehicle sub-brand
|
||||
public int uiSubBrandYearStart;//Vehicle brand year model example: 2010-2013 or 2010
|
||||
public int uiSubBrandYearEnd;
|
||||
RECT stRectLogo; //Car logo coordinate rectangle
|
||||
public int uiConfid; //Confidence
|
||||
}
|
||||
|
||||
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 ItsPicStream extends Structure {
|
||||
|
||||
public int iStructLen; //Structure length
|
||||
public int iChannelID; //Lane number
|
||||
public byte[] cPlate = new byte[32]; //License plate
|
||||
public int iPlateColor; //License plate color
|
||||
public int iPlateType; //License plate type
|
||||
public int iCarColor; //the color of car
|
||||
public RECT tPlateRange; //License plate range
|
||||
public int iCharNum; //The number of characters in the license plate
|
||||
public int[] iCharConfid = new int[12]; //Each character confidence, up to 12 characters
|
||||
public int iPlateConfid; //The entire license plate confidence
|
||||
public int iRecrdoNum; //Identify picture serial number
|
||||
public float fSpeed; //Vehicle speed
|
||||
public int iVehicleDirection; //Direction of the vehicle
|
||||
public int iAlarmType; //Alarm type
|
||||
public byte[] cCameraIP = new byte[16]; //Camera IP
|
||||
public int iRedBeginTime; //Red light start time in seconds
|
||||
public int iRedEndTime; //Red light end time in seconds
|
||||
public int iPicCount; //Record the number of images included
|
||||
public int iSize;
|
||||
public Pointer[] tPicData = new Pointer[8];
|
||||
public int iPlatCount;
|
||||
public Pointer tPlatData;
|
||||
public int iFaceCount;
|
||||
public Pointer[] tFaceData= new Pointer[3];
|
||||
|
||||
public int iPreset; //(The Ball ) preset position number
|
||||
public int iArea; //(The Ball )Area number
|
||||
public byte[] cFileName = new byte[LEN_32]; //Video file name
|
||||
public int iCarSerialNum; //No. of parked vehicle
|
||||
public int iPictureNum; //No. of pictures of vehicles in violation of parking regulations
|
||||
public int iPicType; //Invalid field, no actual meaning
|
||||
public int iPlatePicLen; //Data length of small license plate
|
||||
public int iFacePicNum; //Number of small face pictures
|
||||
public byte[] cChannelName = new byte[LEN_64]; //Lane name
|
||||
public byte[] cChannelDirection = new byte[LEN_64]; //Lane direction
|
||||
public byte[] cCrossingID = new byte[LEN_64]; //Intersection number
|
||||
public byte[] cCrossingName = new byte[LEN_64]; //Intersection name
|
||||
public int iCarRegionNum; //Vehicle contour number, which determines which image tcarregion is based on, starting from 0, where 0 represents the first one.
|
||||
public RECT tCarRegion; //Vehicle contour coordinates, icarregionnum determines which image tcarregion is based on. Icarregionnum starts from 0, where 0 represents the first image.
|
||||
public int iTargetType; //Target type machine is not human ,Car model ( It is not recommended to use this field ,Suggested use iNewTargetType)
|
||||
public int[] iFacePicLen = new int[3]; //Face small graph length
|
||||
public int iRecordAttr; //Record attribute 0- General record ,1- Take the first record before and after ,2- Second records before and after capture
|
||||
public int iLinkageChannelNo; //Lane numbers for associated cameras ,Use before and after snapping
|
||||
public int iLinkageNo; //Linkage number, greater than 0 random number, the same camera linkage number before and after the same capture record, valid before and after pure video capture, others are - 1
|
||||
public byte[] cLinkageCameraIP = new byte[LEN_16]; //Linkage camera IP,Use before and after snapping
|
||||
public int iVehicleBrand; /*Auto Logos ,0:Unknown ;1:Public ;2:Audi ;3:Toyota ;4:Honda ;5:Benz ;6:Chevrolet ;7:Chery ;8:Buick ;9:The Great Wall ;10:modern ;11:NISSAN ;12:Ford ;
|
||||
13:BMW ;14:Citroen ;15:kIa ;16:Suzuki ;17:Mazda ;18:BYD ;20:Beautiful ;21:Changan ;22:LEXUS ;23:The ZH people ;24:SKODA ;25:A hippocampus ;26:Charade ;
|
||||
27:Wuling ;28:East wind ;29:Hafei ;30:FAW ;31:Bao Jun ;32:The Emperor ;33:The name of the name ;34:Southeast ;35:An crown ;36:Golden cup ;37:Mitsubishi ;38:Roewe ;
|
||||
39:Auspicious ;40:English ;41:global hawk ;42:Hafei Saibao ;43:Changfeng ;44:Wei Wang ;45:Beijing ;46:New Kay ;47:Gio ;48:Maserati ;49:rover ;50:Austen ;51:Ma's ;
|
||||
52:dodge ;54:General Pontiac ;55:Jaguar ;56:Ozzy's dawn ;57:alpha ;58:Lamborghini ;59:Bugatti ;60:Lincoln ;61:Ferrari ;62:Changhe ;63:Fiat ;64:Fukuda ;65:Eulogize ;
|
||||
66:Lotus flower ;67:Huapu ;68:red flag ;69:Riich ;70:Pentium ;71:Wei Lin ;72:Zhongtai ;73:Lifan ;74:Beijing jeep ;75:ZTE ;76:karry ;77:Land Rover ;78:Maybach ;
|
||||
79:Renault ;80:Opel ;81:Wild horse ;82:Jeep ;83:Iveco ;84:Infiniti ;85:Subaru ;86:Aston Martin ;87:An Kai ;88:Porsche ;89:Bentley ;90:Fudi ;91:Fujian ;92:Jim ;93:View ;
|
||||
94:Wide steam ;95:Shuanglong ;96:Hagrid ;97:Hummer ;98:Huatai ;99:Yellow Sea ;100:Kowloon ;101:Idea ;102:SMART;103:Land wind ;104:Na Ji Jie ;105:Oley ;106:Kai Chen ;
|
||||
107:Haversian ;108:HOWO ;109:The crowd ;110:golden dragon ;111:Golden brigades ;112:Yangtze and Huai rivers ;113:Jiangling ;114:Cadillac ;115:Cheetah ;116:Mini ;117:Shaanxi steam ;
|
||||
118:Shaolin Temple ;119:Volvo ;120:Isuzu ;121:Leap forward ;122:Yutong ;123:Zhong Tong ;124:Jinling ;125:Shen wo ;126:Yangzi River ;127:Tang Jun Ou Ling ;128:North Run ;129:Red Crag ;
|
||||
130:Rolls-Royce ;131:Tesla ;132:Teng potential ;133:Field ;134:English ;135:West Yat ;136:Star ;137:Daewoo ;138:Alex ;139:Kaye ;140:chase ;141:Shi Ming ;142:Kama. */
|
||||
public RECT_S tFaceRegion; //Face coordinates
|
||||
public int iAlgIllgalType; //Algorithm detecting illegal types ,bit0 No seat belt ,bit1 Phone
|
||||
public int iAlarmCode; //Illegal code,Old field, no longer maintained, please use cAlarmCode.
|
||||
public short sMergePicNum; //Picture synthesis information ,Photo synthesis number
|
||||
public short sMergeType; //Bit synthesis
|
||||
public short sMergePercent; //Synthesis ratio
|
||||
public short sMergeOSDSize; //Synthetic black edge height
|
||||
public short sMergeOSDType; //Synthetic black edge position ,0- Overlay in picture 1- Overlay in black box under picture 2- Overlay in black box on picture
|
||||
public short sSingleOSDSize; //Single black edge height
|
||||
public short sSingleOSDType; //Single black edge position ,0- Overlay in picture 1- Overlay in black box under picture 2- Overlay in black box on picture
|
||||
public short sOriginalImgWidth; //Source image width
|
||||
public short sOriginalImgHeight; //Source image height
|
||||
public RECT_S tVehicleRegion; //Vehicle logo coordinates, this field is valid only when supporting and opening the vehicle logo recognition function, indicating the coordinates of the vehicle logo, the image serial number based on iRecrdoNum determines, otherwise the field is invalid.
|
||||
public RECT_S tCopilotRegion; //Face coordinates of copilot
|
||||
public byte[] cCaptureTimeEx2 = new byte[5*LEN_8]; //Capture time of each picture: year, month, day, week, hour, minute, second and millisecond.
|
||||
public int[] iCaptureLenEx2 = new int[5]; //The length of each picture.
|
||||
public byte[] cUserDefChannelID = new byte[LEN_64]; //Lane customization number
|
||||
public short sBodyOfCarLeight; //Body length (cm)
|
||||
public byte[] cSecurityCode = new byte[LEN_8*LEN_36]; //Image security code
|
||||
public int iSpeedPercent; //Percentage of overspeed
|
||||
public byte[] cLinkPanoramaCapUUID = new byte[LEN_128]; //Linkage panoramic camera snapping linkage UID
|
||||
public int iRedBeginTimeMS; //Red light start time ( Millisecond )
|
||||
public int iRedEndTimeMS; //Red End ( Millisecond )
|
||||
public int iIPDCapType; //Violation of stop the illegal record capture type ,0 automatic ,1 Manual
|
||||
public byte[] cAlarmCode = new byte[LEN_16]; //Illegal code compatibility letter
|
||||
public int[] iCarFeatures = new int[2]; /*Vehicle characteristic attributes, such as hazardous chemicals vehicle, tissue box, etc., by bit, 64 bit is supported. Bit0: do not wear safety belt, Bit1: make a phone call, bit2: main driver's sunshade, bit3: copilot's sunshade,
|
||||
bit4: dangerous chemicals vehicle, bit5: yellow label vehicle, bit6: hanging, bit7: tissue box, bit8: annual inspection label, bit9: high beam lamp, bit10: abnormal license plate, bit11: window standing person.*/
|
||||
public STRCT_BRAND stBrandInfo; //Vehicle label information
|
||||
public int iMainDriverSex; //Driving sex ,0:Unknown ;1:Male ;2:Female sex.
|
||||
public int iCopilpt; //Co driving sex ,0:Unknown ;1:Male ;2:Female sex.
|
||||
public int iNewTargetType; /*Vehicle type ,0:Unknown model ;1:Hatchback car ;2:Sedan ;3:Coupe ;4:Small car ;5:Mini car ;6:MPV;7:SUV;8:Large bus ;9:Medium-sized passenger car ;10:Van ;11:Mini van ;12:Big truck ;13:Medium truck ;14:Fuel tank car ;15:crane ;
|
||||
16:Part of the car ;17:Van ;18:Pickup ;19:Micro card ;20:dogcart ;21:Tricycle ;22:pedestrian ;23:License plate deviation ;24:License plate detection ;25:Head of a car ;26:Tail of a car ;27:Automative lighting ;28:SUV/ MPV;29:trailer;
|
||||
100: bicycle; 101: electric vehicle; 102: motorcycle.*/
|
||||
public int iRealImgWidth; //image width ( Containing synthetic pictures )
|
||||
public int iRealImgHeight; //Image height ( Containing synthetic pictures )
|
||||
public int iBWPlatePicLen; //The data length of small license plate picture after two-value
|
||||
public Pointer pcBWPlateData; //Small license plate picture data after two-value
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package com.whdc.alarm;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class NetClient2 {
|
||||
|
||||
private static NVSSDK2 nvssdk = (NVSSDK2)(System.getProperty("os.name").toLowerCase().startsWith("win")?Native.loadLibrary("NVSSDK.dll",NVSSDK2.class):Native.loadLibrary("libnvssdk.so", NVSSDK2.class));
|
||||
// private static NVSSDK2 nvssdk = NativeLibraryLoader.loadLibraryFromLib(
|
||||
// NVSSDK2.class, "NVSSDK.dll", "libnvssdk.so"
|
||||
// );
|
||||
public static int GetVersion(NVSSDK2.SDK_VERSION _ver) {
|
||||
return nvssdk.NetClient_GetVersion(_ver);
|
||||
}
|
||||
|
||||
public static int SetNotifyFunction(NVSSDK2.MAIN_NOTIFY _cbkMainNotify,
|
||||
NVSSDK2.ALARM_NOTIFY _cbkAlarmNotify, NVSSDK2.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, NVSSDK2.CLIENTINFO _cltInfo,
|
||||
NVSSDK2.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);
|
||||
NVSSDK2.RECT rcShow = new NVSSDK2.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, NVSSDK2.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 , NVSSDK2.ENCODERINFO _pEncoderInfo) {
|
||||
return nvssdk.NetClient_GetDevInfo(_iLogonID, _pEncoderInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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,42 @@
|
|||
package com.whdc.config;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class NativeLibraryLoader {
|
||||
|
||||
/**
|
||||
* 从项目 lib 目录加载本地库
|
||||
*/
|
||||
public static <T> T loadLibraryFromLib(Class<T> interfaceClass, String windowsLibName, String linuxLibName) {
|
||||
try {
|
||||
String projectPath = System.getProperty("user.dir");
|
||||
File libDir = new File(projectPath, "lib");
|
||||
|
||||
if (!libDir.exists()) {
|
||||
throw new RuntimeException("lib 目录不存在: " + libDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
String libraryFile;
|
||||
|
||||
if (os.startsWith("win")) {
|
||||
libraryFile = windowsLibName.endsWith(".dll") ? windowsLibName : windowsLibName + ".dll";
|
||||
} else {
|
||||
libraryFile = linuxLibName.startsWith("lib") ? linuxLibName : "lib" + linuxLibName + ".so";
|
||||
}
|
||||
|
||||
File library = new File(libDir, libraryFile);
|
||||
if (!library.exists()) {
|
||||
throw new RuntimeException("库文件不存在: " + library.getAbsolutePath());
|
||||
}
|
||||
|
||||
System.out.println("加载库文件: " + library.getAbsolutePath());
|
||||
return (T) Native.loadLibrary(library.getAbsolutePath(), interfaceClass);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("加载本地库失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.dto.AlarmRecordQuery;
|
||||
import com.whdc.dto.ApiResponse;
|
||||
import com.whdc.dto.StartStreamRequest;
|
||||
import com.whdc.entity.AlarmRecord;
|
||||
import com.whdc.service.impl.AlarmRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/alarms")
|
||||
public class AlarmRecordController {
|
||||
|
||||
@Autowired
|
||||
private AlarmRecordService alarmRecordService;
|
||||
|
||||
@PostMapping("/query")
|
||||
public ApiResponse<List<AlarmRecord>> query(@RequestBody AlarmRecordQuery request) {
|
||||
try {
|
||||
return ApiResponse.success(alarmRecordService.queryList(request));
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("查询告警失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.dto.ApiResponse;
|
||||
import com.whdc.entity.CameraConfig;
|
||||
import com.whdc.service.impl.CameraConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/camera")
|
||||
public class CameraConfigController {
|
||||
|
||||
@Autowired
|
||||
private CameraConfigService service;
|
||||
|
||||
@GetMapping("/query/list")
|
||||
public ApiResponse<List<CameraConfig>> queryList() {
|
||||
return ApiResponse.success(service.getEnabledCameras());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.dto.ApiResponse;
|
||||
import com.whdc.dto.LoginRequest;
|
||||
import com.whdc.service.impl.DeviceLoginService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/device")
|
||||
public class DeviceLoginController {
|
||||
|
||||
@Autowired
|
||||
private DeviceLoginService service;
|
||||
|
||||
/**
|
||||
* 初始化SDK
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public ApiResponse<String> initSdk() {
|
||||
return ApiResponse.success(service.initializeSDK());
|
||||
}
|
||||
|
||||
@PostMapping("/login/active")
|
||||
public ApiResponse<Map<String, Object>> loginActiveDevice(@RequestBody LoginRequest request) {
|
||||
try {
|
||||
return ApiResponse.success(service.loginActiveDevice(request));
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("设备登录失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录状态
|
||||
*/
|
||||
@GetMapping("/status")
|
||||
public ApiResponse<Map<String, Object>> getLoginStatus(@RequestParam String deviceKey) {
|
||||
return ApiResponse.success(service.getLoginStatus(deviceKey));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.dto.LoginRequest;
|
||||
import com.whdc.dto.UserLoginRequest;
|
||||
import com.whdc.entity.User;
|
||||
import com.whdc.service.impl.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 用户登录接口
|
||||
* POST http://localhost:8080/api/login
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public Map<String, Object> login(@RequestBody UserLoginRequest request) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
User user = userService.login(request.getUsername(), request.getPassword());
|
||||
|
||||
result.put("code", 200);
|
||||
result.put("message", "登录成功");
|
||||
result.put("data", user);
|
||||
// result.put("data", Map.of(
|
||||
// "userId", user.getUserId(),
|
||||
// "userName", user.getUserName(),
|
||||
// "phoneNumber", user.getPhoneNumber(),
|
||||
// "status", user.getStatus()
|
||||
// ));
|
||||
} catch (Exception e) {
|
||||
result.put("code", 500);
|
||||
result.put("message", e.getMessage());
|
||||
result.put("data", null);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.dto.ApiResponse;
|
||||
import com.whdc.dto.PlaybackRequest;
|
||||
import com.whdc.service.impl.PlaybackService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/playback")
|
||||
public class PlaybackController {
|
||||
|
||||
@Autowired
|
||||
private PlaybackService playbackService;
|
||||
|
||||
@PostMapping("/start")
|
||||
public ApiResponse<Map<String, Object>> startPlayback(@RequestBody PlaybackRequest request) {
|
||||
try {
|
||||
Map<String, Object> result = playbackService.startPlayback(request);
|
||||
return ApiResponse.success("回放启动成功", result);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("回放启动失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/stop/{playbackId}")
|
||||
public ApiResponse<Boolean> stopPlayback(@PathVariable String playbackId) {
|
||||
try {
|
||||
boolean result = playbackService.stopPlayback(playbackId);
|
||||
return ApiResponse.success("回放停止成功", result);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("回放停止失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/status/{playbackId}")
|
||||
public ApiResponse<Map<String, Object>> getPlaybackStatus(@PathVariable String playbackId) {
|
||||
try {
|
||||
Map<String, Object> status = playbackService.getPlaybackStatus(playbackId);
|
||||
return ApiResponse.success("获取回放状态成功", status);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("获取回放状态失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.service.impl.VehicleDetectionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/detection")
|
||||
public class VehicleDetectionController {
|
||||
|
||||
@Autowired
|
||||
private VehicleDetectionService vehicleDetectionService;
|
||||
|
||||
@PostMapping("/start")
|
||||
public ResponseEntity<String> startDetection() {
|
||||
vehicleDetectionService.startDetection();
|
||||
return ResponseEntity.ok("车辆检测已启动");
|
||||
}
|
||||
|
||||
@PostMapping("/stop")
|
||||
public ResponseEntity<String> stopDetection() {
|
||||
vehicleDetectionService.stopDetection();
|
||||
return ResponseEntity.ok("车辆检测已停止");
|
||||
}
|
||||
|
||||
@GetMapping("/status")
|
||||
public ResponseEntity<Boolean> getDetectionStatus() {
|
||||
boolean isRunning = vehicleDetectionService.isRunning();
|
||||
return ResponseEntity.ok(isRunning);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,195 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.callback.RawFrameCallback;
|
||||
import com.whdc.dto.ApiResponse;
|
||||
import com.whdc.dto.PTZControlRequest;
|
||||
import com.whdc.dto.StartStreamRequest;
|
||||
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<Integer> login(@RequestBody com.whdc.dto.LoginRequest request) {
|
||||
try {
|
||||
|
||||
return ApiResponse.success(videoService.login(
|
||||
request.getIp(),
|
||||
request.getPort(),
|
||||
request.getUsername(),
|
||||
request.getPassword()
|
||||
));
|
||||
} 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, com.whdc.dto.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 (request.getM_iServerID() < 0) {
|
||||
return ApiResponse.error("请先登录设备");
|
||||
}
|
||||
|
||||
boolean success = videoService.controlDirection(
|
||||
request.getM_iServerID(),
|
||||
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.getM_iServerID(),
|
||||
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,111 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.dto.ApiResponse;
|
||||
import com.whdc.dto.LoginRequest;
|
||||
import com.whdc.dto.StartStreamRequest;
|
||||
import com.whdc.service.impl.VideoPlayService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/video/play")
|
||||
public class VideoPlayController {
|
||||
|
||||
@Autowired
|
||||
private VideoPlayService videoPlayService;
|
||||
|
||||
@PostMapping("/init")
|
||||
public ApiResponse<Boolean> initSDK() {
|
||||
try {
|
||||
boolean result = videoPlayService.initSDK();
|
||||
return ApiResponse.success("SDK初始化成功", result);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("SDK初始化失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
public ApiResponse<Integer> login(@RequestBody LoginRequest request) {
|
||||
try {
|
||||
int logonId = videoPlayService.login(
|
||||
request.getIp(),
|
||||
request.getPort(),
|
||||
request.getUsername(),
|
||||
request.getPassword()
|
||||
);
|
||||
return ApiResponse.success("登录成功", logonId);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("登录失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/stream/start")
|
||||
public ApiResponse<String> startPlay(@RequestBody StartStreamRequest request) {
|
||||
try {
|
||||
// videoPlayService.initSDK();
|
||||
// int logonId = videoPlayService.login(request.getDeviceIp(), request.getDevicePort(), request.getUsername(), request.getPassword());
|
||||
String streamId = videoPlayService.startStream(
|
||||
request.getM_iServerID(),
|
||||
request.getChannelNo(),
|
||||
request.getStreamType(),
|
||||
request.getNetMode()
|
||||
);
|
||||
return ApiResponse.success("视频流启动成功", streamId);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("启动视频流失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/stream/stop/{streamId}")
|
||||
public ApiResponse<Boolean> stopstream(@PathVariable String streamId) {
|
||||
try {
|
||||
boolean result = videoPlayService.stopStream(streamId);
|
||||
return ApiResponse.success("视频流停止成功", result);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("停止视频流失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/logout/{logonId}")
|
||||
public ApiResponse<Boolean> logout(@PathVariable int logonId) {
|
||||
try {
|
||||
boolean result = videoPlayService.logout(logonId);
|
||||
return ApiResponse.success("登出成功", result);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("登出失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/cleanup")
|
||||
public ApiResponse<Boolean> cleanup() {
|
||||
try {
|
||||
boolean result = videoPlayService.cleanup();
|
||||
return ApiResponse.success("SDK清理成功", result);
|
||||
} catch (Exception e) {
|
||||
return ApiResponse.error("SDK清理失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/status/{streamId}")
|
||||
public ResponseEntity<Map<String, Object>> getStreamStatus(@PathVariable String streamId) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
Map<String, Object> status = videoPlayService.getSessionStatus(streamId);
|
||||
if (status != null) {
|
||||
result.put("success", true);
|
||||
result.put("status", status);
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "流不存在");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "获取状态失败: " + e.getMessage());
|
||||
}
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.entity.QueryDto;
|
||||
import com.whdc.entity.WqR;
|
||||
import com.whdc.mqtt.ResultJson;
|
||||
import com.whdc.service.WqRService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wq")
|
||||
public class WqRController {
|
||||
|
||||
@Resource
|
||||
private WqRService service;
|
||||
|
||||
|
||||
@PostMapping("/list")
|
||||
public ResultJson<List<WqR>> list(@RequestBody @Validated QueryDto queryDto ) {
|
||||
return ResultJson.ok(service.getList(queryDto));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
package com.whdc.controller;
|
||||
|
||||
import com.whdc.entity.WqRReal;
|
||||
import com.whdc.mqtt.ResultJson;
|
||||
import com.whdc.service.WqRRealService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wq/real")
|
||||
public class WqRealController {
|
||||
|
||||
@Resource
|
||||
private WqRRealService service;
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public ResultJson<List<WqRReal>> list() {
|
||||
return ResultJson.ok(service.getList());
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/online")
|
||||
public ResultJson< Map<Boolean, List<WqRReal>>> online() {
|
||||
return ResultJson.ok(service.online());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class AlarmRecordQuery {
|
||||
|
||||
private String cameraIp;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
}
|
||||
|
|
@ -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,13 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LoginRequest {
|
||||
private String ip;
|
||||
private Integer port;
|
||||
private String username;
|
||||
private String password;
|
||||
private String factoryId;
|
||||
private Integer localPort;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PTZControlRequest {
|
||||
private int m_iServerID = -1;
|
||||
private Integer channelNo = 0;
|
||||
private Integer direction;
|
||||
private Integer speed = 50;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class PlaybackRequest {
|
||||
private int m_iServerID;
|
||||
private Integer channelNo;
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
private Integer streamType = 0; // 0-主码流, 1-子码流
|
||||
private Integer speed = 1; // 播放速度 1,2,4,8,16,32
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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,17 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StartStreamRequest {
|
||||
|
||||
private String deviceIp;
|
||||
private Integer devicePort;
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
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,10 @@
|
|||
package com.whdc.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserLoginRequest {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.whdc.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("alarm_records")
|
||||
public class AlarmRecord {
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@TableField(value = "camera_ip")
|
||||
private String cameraIP;
|
||||
|
||||
@TableField(value = "camera_name")
|
||||
private String cameraName;
|
||||
|
||||
@TableField(value = "license_plate")
|
||||
private String licensePlate;
|
||||
|
||||
@TableField(value = "car_color")
|
||||
private String carColor;
|
||||
|
||||
@TableField(value = "plate_color")
|
||||
private String plateColor;
|
||||
|
||||
@TableField(value = "channel_id")
|
||||
private Integer channelID;
|
||||
|
||||
@TableField(value = "alarm_time")
|
||||
private LocalDateTime alarmTime;
|
||||
|
||||
@TableField(value = "speed")
|
||||
private Double speed;
|
||||
|
||||
@TableField(value = "alarm_type")
|
||||
private Integer alarmType;
|
||||
|
||||
@TableField(value = "alarm_code")
|
||||
private String alarmCode;
|
||||
|
||||
@TableField(value = "image_path")
|
||||
private String imagePath;
|
||||
|
||||
@TableField(value = "create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.whdc.entity;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@TableName("camera_config")
|
||||
public class CameraConfig {
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@TableField(value = "camera_name")
|
||||
private String cameraName;
|
||||
|
||||
@TableField(value = "camera_ip")
|
||||
private String cameraIP;
|
||||
|
||||
@TableField(value = "username")
|
||||
private String username;
|
||||
|
||||
@TableField(value = "password")
|
||||
private String password;
|
||||
|
||||
@TableField(value = "port")
|
||||
private Integer port = 3000;
|
||||
|
||||
@TableField(value = "channel_no")
|
||||
private Integer channelNo = 0;
|
||||
|
||||
@TableField(value = "enabled")
|
||||
private Integer enabled = 1;
|
||||
|
||||
@TableField(value = "description")
|
||||
private String description;
|
||||
|
||||
@TableField(value = "factory_id")
|
||||
private String factoryId;
|
||||
|
||||
@TableField(value = "local_port")
|
||||
private Integer localPort;
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.whdc.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class QueryDto {
|
||||
|
||||
@NotBlank(message = "站点不能为空")
|
||||
private String mn;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.whdc.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@TableName("sys_user")
|
||||
public class User {
|
||||
|
||||
@TableId(value="user_id", type= IdType.AUTO)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
@TableField(value = "user_name")
|
||||
private String userName;
|
||||
|
||||
@TableField(value = "password")
|
||||
private String password;
|
||||
|
||||
@TableField(value = "phone_number")
|
||||
private String phoneNumber;
|
||||
|
||||
@TableField(value = "status")
|
||||
private String status = "0";
|
||||
|
||||
@TableField(value = "create_time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
package com.whdc.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 水质信息表
|
||||
* </p>
|
||||
*
|
||||
* @author wanyan
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("wq_r")
|
||||
@Data
|
||||
public class WqR {
|
||||
|
||||
@TableId(value = "mn")
|
||||
private String mn;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@TableField("tm")
|
||||
private LocalDateTime tm;
|
||||
|
||||
@TableField("cod")
|
||||
private BigDecimal cod;
|
||||
|
||||
@TableField("ad")
|
||||
private BigDecimal ad;
|
||||
|
||||
@TableField("ph")
|
||||
private BigDecimal ph;
|
||||
|
||||
@TableField("p")
|
||||
private BigDecimal p;
|
||||
|
||||
@TableField("cn")
|
||||
private String cn;
|
||||
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
package com.whdc.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 水质实时信息表
|
||||
* </p>
|
||||
*
|
||||
* @author wanyan
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("wq_r_real")
|
||||
@Data
|
||||
public class WqRReal {
|
||||
|
||||
@TableId(value = "mn")
|
||||
private String mn;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@TableField("tm")
|
||||
private LocalDateTime tm;
|
||||
|
||||
@TableField("cod")
|
||||
private BigDecimal cod;
|
||||
|
||||
@TableField("ad")
|
||||
private BigDecimal ad;
|
||||
|
||||
@TableField("ph")
|
||||
private BigDecimal ph;
|
||||
|
||||
@TableField("p")
|
||||
private BigDecimal p;
|
||||
|
||||
@TableField("cn")
|
||||
private String cn;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.whdc.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.whdc.entity.AlarmRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AlarmRecordMapper extends BaseMapper<AlarmRecord> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.whdc.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.whdc.entity.CameraConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CameraConfigMapper extends BaseMapper<CameraConfig> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.whdc.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.whdc.entity.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<User> {
|
||||
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
package com.whdc.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.whdc.entity.WqR;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 水质信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wanyan
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
@Mapper
|
||||
public interface WqRMapper extends BaseMapper<WqR> {
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
package com.whdc.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.whdc.entity.WqRReal;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 水质实时信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author wanyan
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
@Mapper
|
||||
public interface WqRealMapper extends BaseMapper<WqRReal> {
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
package com.whdc.mqtt;
|
||||
|
||||
public class Config {
|
||||
public static final String USERNAME = "jiangling";
|
||||
public static final char[] PASSWORD = "Gsiot_890".toCharArray();
|
||||
|
||||
public static final String TOPIC_WQ_R = "/jiangling";
|
||||
|
||||
}
|
||||
|
|
@ -1,192 +0,0 @@
|
|||
package com.whdc.mqtt;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.whdc.entity.WqR;
|
||||
import com.whdc.entity.WqRReal;
|
||||
import com.whdc.mapper.WqRMapper;
|
||||
import com.whdc.mapper.WqRealMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class MQTTConfig {
|
||||
|
||||
@Autowired
|
||||
private WqRMapper wqRMapper;
|
||||
|
||||
@Autowired
|
||||
private WqRealMapper wqRealMapper;
|
||||
|
||||
@Value("${mqtt.broker}")
|
||||
private String broker;
|
||||
|
||||
@Value("${mqtt.clientId}")
|
||||
private String clientId;
|
||||
|
||||
@Value("${enableMqttListening:true}") // 设置默认值
|
||||
private Boolean enable;
|
||||
|
||||
private Sub sub;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
private static final DateTimeFormatter formatter =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@PostConstruct
|
||||
public void initMQTT() {
|
||||
if (!enable) {
|
||||
log.info("MQTT监听未启用");
|
||||
return;
|
||||
}
|
||||
|
||||
log.info("初始化MQTT连接 - broker: {}, clientId: {}", broker, clientId);
|
||||
|
||||
try {
|
||||
sub = new Sub(broker, clientId, Config.TOPIC_WQ_R);
|
||||
sub.setOnMessageListener(new Sub.OnMessageListener() {
|
||||
@Override
|
||||
public void onMessage(String message) {
|
||||
processMessage(message);
|
||||
}
|
||||
});
|
||||
|
||||
// 延迟连接,确保Spring完全启动
|
||||
new Thread(() -> {
|
||||
try {
|
||||
log.info("等待10秒后建立MQTT连接...");
|
||||
Thread.sleep(10000);
|
||||
sub.connect(true);
|
||||
log.info("MQTT连接初始化完成");
|
||||
} catch (MqttException e) {
|
||||
log.error("MQTT连接失败: {}", e.getMessage(), e);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
log.error("MQTT连接线程被中断");
|
||||
}
|
||||
}, "MQTT-Connector").start();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("初始化MQTT配置失败: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void processMessage(String message) {
|
||||
try {
|
||||
log.debug("收到MQTT消息: {}", message);
|
||||
|
||||
JsonNode jsonNode = objectMapper.readTree(message);
|
||||
|
||||
// 验证必需字段
|
||||
if (!jsonNode.has("DataTime") || !jsonNode.has("Mn")) {
|
||||
log.warn("MQTT消息缺少必需字段: {}", message);
|
||||
return;
|
||||
}
|
||||
|
||||
// 解析JSON数据
|
||||
String dataTimeStr = jsonNode.get("DataTime").asText();
|
||||
String mn = jsonNode.get("Mn").asText();
|
||||
|
||||
String cn = jsonNode.get("CN").asText();
|
||||
|
||||
// 解析水质参数
|
||||
BigDecimal cod = parseDecimalValue(jsonNode.get("w01018"));
|
||||
BigDecimal ad = parseDecimalValue(jsonNode.get("w21003"));
|
||||
BigDecimal p = parseDecimalValue(jsonNode.get("w21011"));
|
||||
BigDecimal ph = parseDecimalValue(jsonNode.get("w01001"));
|
||||
|
||||
// 转换时间格式
|
||||
LocalDateTime dataTime;
|
||||
try {
|
||||
dataTime = LocalDateTime.parse(dataTimeStr, formatter);
|
||||
} catch (DateTimeParseException e) {
|
||||
log.error("时间格式解析错误: {}, 原始数据: {}", dataTimeStr, message);
|
||||
return;
|
||||
}
|
||||
|
||||
// 保存到历史数据表
|
||||
saveToWqR(mn, dataTime, cn, cod, ad, p, ph);
|
||||
|
||||
// 更新实时数据表
|
||||
updateWqReal(mn, dataTime, cn, cod, ad, p, ph);
|
||||
|
||||
log.info("成功处理水质数据 - 站点: {}, 时间: {}", mn, dataTime);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("处理MQTT消息时发生错误: {}, 原始数据: {}", e.getMessage(), message, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveToWqR(String mn, LocalDateTime dataTime, String cn,
|
||||
BigDecimal cod, BigDecimal ad, BigDecimal p, BigDecimal ph) {
|
||||
try {
|
||||
WqR wqR = new WqR();
|
||||
wqR.setMn(mn);
|
||||
wqR.setTm(dataTime);
|
||||
wqR.setCod(cod);
|
||||
wqR.setAd(ad);
|
||||
wqR.setP(p);
|
||||
wqR.setPh(ph);
|
||||
wqR.setCn(cn);
|
||||
|
||||
wqRMapper.insert(wqR);
|
||||
log.debug("历史数据保存成功 - 站点: {}", mn);
|
||||
} catch (Exception e) {
|
||||
log.error("保存历史数据失败 - 站点: {}, 错误: {}", mn, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWqReal(String mn, LocalDateTime dataTime, String cn,
|
||||
BigDecimal cod, BigDecimal ad, BigDecimal p, BigDecimal ph) {
|
||||
try {
|
||||
WqRReal wqReal = wqRealMapper.selectById(mn);
|
||||
if (wqReal == null) {
|
||||
wqReal = new WqRReal();
|
||||
wqReal.setMn(mn);
|
||||
wqReal.setTm(dataTime);
|
||||
wqReal.setCod(cod);
|
||||
wqReal.setAd(ad);
|
||||
wqReal.setP(p);
|
||||
wqReal.setPh(ph);
|
||||
wqReal.setCn(cn);
|
||||
wqRealMapper.insert(wqReal);
|
||||
log.debug("新增实时数据 - 站点: {}", mn);
|
||||
} else {
|
||||
wqReal.setTm(dataTime);
|
||||
wqReal.setCod(cod);
|
||||
wqReal.setAd(ad);
|
||||
wqReal.setP(p);
|
||||
wqReal.setPh(ph);
|
||||
wqReal.setCn(cn);
|
||||
wqRealMapper.updateById(wqReal);
|
||||
log.debug("更新实时数据 - 站点: {}", mn);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("更新实时数据失败 - 站点: {}, 错误: {}", mn, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal parseDecimalValue(JsonNode node) {
|
||||
if (node != null && !node.isNull() && !node.asText().isEmpty()) {
|
||||
try {
|
||||
return new BigDecimal(node.asText());
|
||||
} catch (NumberFormatException e) {
|
||||
log.warn("解析数值失败: {}", node.asText());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
package com.whdc.mqtt;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.eclipse.paho.client.mqttv3.MqttClient;
|
||||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
|
||||
import org.eclipse.paho.client.mqttv3.MqttException;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
|
||||
public class Pub {
|
||||
private final String clientId;
|
||||
private final String topic;
|
||||
public static String BROKER;
|
||||
private final int qos;
|
||||
private MqttClient client;
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
public Pub(String clientId, String topic) {
|
||||
this.clientId = clientId;
|
||||
this.topic = topic;
|
||||
this.qos = 0;
|
||||
}
|
||||
|
||||
public Pub(String clientId, String topic, int qos) {
|
||||
this.clientId = clientId;
|
||||
this.topic = topic;
|
||||
this.qos = qos;
|
||||
}
|
||||
|
||||
public void connect() throws MqttException {
|
||||
this.client = new MqttClient("tcp://120.24.5.249:3189", "mqttx_2b072a3c", new MemoryPersistence());
|
||||
MqttConnectOptions connOpts = new MqttConnectOptions();
|
||||
connOpts.setUserName(Config.USERNAME);
|
||||
connOpts.setPassword(Config.PASSWORD);
|
||||
connOpts.setCleanSession(true);
|
||||
this.client.connect(connOpts);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
try {
|
||||
this.client.disconnectForcibly(200);
|
||||
this.client.close(true);
|
||||
} catch (MqttException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void pub(String msg) throws MqttException {
|
||||
MqttMessage message = new MqttMessage(msg.getBytes());
|
||||
message.setQos(qos);
|
||||
this.client.publish(topic, message);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
// 创建发布者
|
||||
Pub publisher = new Pub("mqttx_2b072a3c", Config.TOPIC_WQ_R, 1);
|
||||
|
||||
// 连接到MQTT Broker
|
||||
publisher.connect();
|
||||
System.out.println("MQTT发布者连接成功!");
|
||||
|
||||
// 创建测试数据
|
||||
String[] testData = {
|
||||
createTestData("2025-11-20 10:00:00", "0000001", "61.3", "0.83", "1.4", "7.2"),
|
||||
createTestData("2025-11-20 11:00:00", "0000002", "54.2", "0.99", "1.3", "7.5"),
|
||||
// createTestData("2025-11-19 16:00:00", "0000003", "62.3", "0.78", "1.3", "7.5"),
|
||||
// createTestData("2025-11-19 17:00:00", "0000001", "59.9", "0.83", "1.3", "7.7"),
|
||||
// createTestData("2025-11-19 18:00:00", "0000002", "62.5", "0.85", "1.6", "7.8")
|
||||
};
|
||||
|
||||
// 发送测试数据
|
||||
for (int i = 0; i < testData.length; i++) {
|
||||
String data = testData[i];
|
||||
publisher.pub(data);
|
||||
System.out.println("发送第 " + (i + 1) + " 条数据: " + data);
|
||||
|
||||
// 间隔2秒发送一条
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
|
||||
System.out.println("所有测试数据发送完成!");
|
||||
|
||||
// 保持连接,等待用户输入后关闭
|
||||
System.out.println("按回车键退出...");
|
||||
System.in.read();
|
||||
|
||||
publisher.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static String createTestData(String dataTime, String mn, String cod, String ad, String p, String ph) {
|
||||
try {
|
||||
ObjectNode json = objectMapper.createObjectNode();
|
||||
json.put("DataTime", dataTime);
|
||||
json.put("Mn", mn);
|
||||
json.put("CN", "2061");
|
||||
json.put("w01018", cod); // COD
|
||||
json.put("w21003", ad); // 氨氮
|
||||
json.put("w21011", p); // 总磷
|
||||
json.put("w01001", ph); // PH
|
||||
|
||||
return json.toString();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("创建测试数据失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
package com.whdc.mqtt;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Component
|
||||
@SuppressWarnings("all")
|
||||
public class ResultJson<T> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
public static final Integer SUCCESS = 200;
|
||||
public static final String SUCCESS_MSG = "success";
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
public static final Integer FAIL = 900;
|
||||
public static final String FAIL_MSG = "fail";
|
||||
|
||||
public static final Integer PARAM_ERROR = 400; // 失败、参数错误等
|
||||
public static final Integer UNAUTHORIZED = 401; // 用户验证失败,或者用户验证信息过期
|
||||
public static final Integer PERMISSION_DENIED = 403; // 没有权限
|
||||
public static final Integer NOT_FOUND = 404; // 未找到资源
|
||||
public static final Integer METHOD_NOT_ALLOWED = 405; // 不支持的类型
|
||||
public static final Integer NSUPPORTED_MEDIA_TYPE = 415; // 不支持的媒体
|
||||
public static final Integer NOT_ALLOWED = 405; // 请求太频繁,同一个用户(token)、同一个url、同样的请求参数,请求间隔小于0.5秒
|
||||
public static final Integer SERVER_ERROR = 500; // 后台错误
|
||||
public static final Integer SRC_TIMEOUT = 504; // 请求资源超时
|
||||
|
||||
|
||||
private String msg;
|
||||
|
||||
private Integer code;
|
||||
|
||||
private T data;
|
||||
|
||||
|
||||
public static ResultJson error() {
|
||||
return error(FAIL, "未知异常,请联系管理员");
|
||||
}
|
||||
|
||||
public static ResultJson error(String msg) {
|
||||
return error(FAIL, msg);
|
||||
}
|
||||
|
||||
public static ResultJson error(int code, String msg) {
|
||||
ResultJson r = new ResultJson();
|
||||
r.setCode(code);
|
||||
r.setMsg(msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static ResultJson error(int code, String msg, Object data) {
|
||||
ResultJson r = new ResultJson();
|
||||
r.setCode(code);
|
||||
r.setMsg(msg);
|
||||
r.setData(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static ResultJson ok(Integer code, String msg) {
|
||||
ResultJson r = new ResultJson();
|
||||
r.setMsg(msg);
|
||||
r.setCode(code);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static ResultJson ok() {
|
||||
ResultJson r = new ResultJson();
|
||||
r.setCode(SUCCESS);
|
||||
r.setMsg(SUCCESS_MSG);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static ResultJson ok(Object data) {
|
||||
ResultJson r = new ResultJson();
|
||||
r.setCode(SUCCESS);
|
||||
r.setMsg(SUCCESS_MSG);
|
||||
r.setData(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static ResultJson ok(Object data, String msg) {
|
||||
ResultJson r = new ResultJson();
|
||||
r.setData(data);
|
||||
r.setCode(SUCCESS);
|
||||
r.setMsg(msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public static Integer getSUCCESS() {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
public static String getSuccessMsg() {
|
||||
return SUCCESS_MSG;
|
||||
}
|
||||
|
||||
public static Integer getFAIL() {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
public static String getFailMsg() {
|
||||
return FAIL_MSG;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResultJson{" +
|
||||
"msg='" + msg + "'" +
|
||||
", code=" + code +
|
||||
", data=" + data +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
package com.whdc.mqtt;
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class Sub {
|
||||
private final String clientId;
|
||||
private final String topic;
|
||||
private final String broker;
|
||||
private OnMessageListener onMessageListener;
|
||||
private MqttClient client;
|
||||
|
||||
public Sub(String broker, String clientId, String topic) {
|
||||
this.clientId = clientId;
|
||||
this.topic = topic;
|
||||
this.broker = broker;
|
||||
}
|
||||
|
||||
public void setOnMessageListener(OnMessageListener listener) {
|
||||
this.onMessageListener = listener;
|
||||
}
|
||||
|
||||
public void connect() throws MqttException {
|
||||
connect(true);
|
||||
}
|
||||
|
||||
public void connect(boolean autoReconnect) throws MqttException {
|
||||
try {
|
||||
// 使用唯一的客户端ID
|
||||
String uniqueClientId = this.clientId + "_" + System.currentTimeMillis();
|
||||
|
||||
this.client = new MqttClient(broker, uniqueClientId, new MemoryPersistence());
|
||||
|
||||
MqttConnectOptions connOpts = new MqttConnectOptions();
|
||||
connOpts.setUserName(Config.USERNAME);
|
||||
connOpts.setPassword(Config.PASSWORD); // 修复:使用char数组
|
||||
connOpts.setCleanSession(true);
|
||||
connOpts.setAutomaticReconnect(autoReconnect);
|
||||
connOpts.setConnectionTimeout(30); // 设置连接超时
|
||||
connOpts.setKeepAliveInterval(60); // 设置心跳间隔
|
||||
|
||||
// 设置MQTT版本(重要)
|
||||
connOpts.setMqttVersion(MqttConnectOptions.MQTT_VERSION_3_1);
|
||||
|
||||
this.client.setCallback(new MqttCallbackExtended() {
|
||||
@Override
|
||||
public void connectComplete(boolean reconnect, String serverURI) {
|
||||
log.info("MQTT连接{}成功: {}", reconnect ? "重连" : "建立", serverURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectionLost(Throwable cause) {
|
||||
log.error("MQTT连接丢失: {}", cause != null ? cause.getMessage() : "未知原因");
|
||||
if (cause != null) {
|
||||
cause.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage mqttMessage) {
|
||||
try {
|
||||
byte[] payload = mqttMessage.getPayload();
|
||||
String msg = new String(payload, "UTF-8");
|
||||
log.debug("收到MQTT消息 - 主题: {}, QoS: {}", topic, mqttMessage.getQos());
|
||||
|
||||
if (onMessageListener != null) {
|
||||
onMessageListener.onMessage(msg);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
log.error("处理MQTT消息时发生错误: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
|
||||
// 订阅者不需要实现此方法
|
||||
}
|
||||
});
|
||||
|
||||
log.info("正在连接到MQTT服务器: {}, 客户端ID: {}", broker, uniqueClientId);
|
||||
this.client.connect(connOpts);
|
||||
|
||||
// 使用QoS 1确保消息可靠传递
|
||||
this.client.subscribe(this.topic, 1);
|
||||
log.info("成功订阅主题: {}", this.topic);
|
||||
|
||||
} catch (MqttException e) {
|
||||
log.error("MQTT连接失败: {}, 错误代码: {}", e.getMessage(), e.getReasonCode());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void close() {
|
||||
try {
|
||||
if (this.client != null && this.client.isConnected()) {
|
||||
this.client.disconnect();
|
||||
this.client.close();
|
||||
log.info("MQTT客户端已关闭");
|
||||
}
|
||||
} catch (MqttException e) {
|
||||
log.error("关闭MQTT客户端时发生错误: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return this.client != null && this.client.isConnected();
|
||||
}
|
||||
|
||||
public interface OnMessageListener {
|
||||
void onMessage(String message);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
Sub sub = new Sub("tcp://120.24.5.249:3189", "test_client", Config.TOPIC_WQ_R);
|
||||
sub.setOnMessageListener(new OnMessageListener() {
|
||||
@Override
|
||||
public void onMessage(String message) {
|
||||
System.out.println("收到消息: " + message);
|
||||
}
|
||||
});
|
||||
sub.connect(true);
|
||||
|
||||
// 保持程序运行
|
||||
Thread.sleep(300000); // 5分钟
|
||||
sub.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,484 @@
|
|||
package com.whdc.playback;
|
||||
|
||||
import com.sun.jna.Callback;
|
||||
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;
|
||||
|
||||
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,121 @@
|
|||
package com.whdc.playback;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.whdc.config.NativeLibraryLoader;
|
||||
|
||||
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));
|
||||
// private static NVSSDK nvssdk = NativeLibraryLoader.loadLibraryFromLib(
|
||||
// NVSSDK.class, "NVSSDK.dll", "libnvssdk.so"
|
||||
// );
|
||||
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,333 @@
|
|||
package com.whdc.service;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.whdc.alarm.NVSSDK2;
|
||||
import com.whdc.alarm.NetClient2;
|
||||
import com.whdc.dto.LoginRequest;
|
||||
import com.whdc.entity.AlarmRecord;
|
||||
import com.whdc.entity.CameraConfig;
|
||||
import com.whdc.service.impl.AlarmRecordService;
|
||||
import com.whdc.service.impl.DeviceLoginService;
|
||||
import com.whdc.syncjava.NetClient3;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class CameraDetectionSession {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CameraDetectionSession.class);
|
||||
|
||||
private final CameraConfig cameraConfig;
|
||||
private final AlarmRecordService alarmRecordService;
|
||||
private final String imageSavePath;
|
||||
private final DeviceLoginService deviceLoginService;
|
||||
|
||||
private int logonID = -1;
|
||||
private int connectID = -1;
|
||||
private final AtomicBoolean isRunning = new AtomicBoolean(false);
|
||||
private Thread detectionThread;
|
||||
|
||||
private final String[] strCarPlateColor;
|
||||
private final String[] strCarColor;
|
||||
|
||||
public CameraDetectionSession(CameraConfig cameraConfig,
|
||||
AlarmRecordService alarmRecordService,
|
||||
String imageSavePath,
|
||||
String[] strCarPlateColor,
|
||||
String[] strCarColor,
|
||||
DeviceLoginService deviceLoginService) {
|
||||
this.cameraConfig = cameraConfig;
|
||||
this.alarmRecordService = alarmRecordService;
|
||||
this.imageSavePath = imageSavePath;
|
||||
this.strCarPlateColor = strCarPlateColor;
|
||||
this.strCarColor = strCarColor;
|
||||
this.deviceLoginService = deviceLoginService;
|
||||
}
|
||||
|
||||
public void startDetection() {
|
||||
if (isRunning.get()) {
|
||||
logger.warn("摄像头 {} 的检测已经在运行", cameraConfig.getCameraIP());
|
||||
return;
|
||||
}
|
||||
|
||||
detectionThread = new Thread(this::runDetection, "CameraDetection-" + cameraConfig.getCameraIP());
|
||||
detectionThread.start();
|
||||
}
|
||||
|
||||
public void stopDetection() {
|
||||
if (!isRunning.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
isRunning.set(false);
|
||||
|
||||
// 停止SDK连接
|
||||
if (connectID != -1) {
|
||||
NetClient2.StopRecv(connectID);
|
||||
connectID = -1;
|
||||
}
|
||||
if (logonID != -1) {
|
||||
NetClient2.Logoff(logonID);
|
||||
logonID = -1;
|
||||
}
|
||||
|
||||
// 等待线程结束
|
||||
if (detectionThread != null && detectionThread.isAlive()) {
|
||||
try {
|
||||
detectionThread.join(5000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("摄像头 {} 的检测已停止", cameraConfig.getCameraIP());
|
||||
}
|
||||
|
||||
private void runDetection() {
|
||||
try {
|
||||
isRunning.set(true);
|
||||
logger.info("开始摄像头 {} 的车辆检测", cameraConfig.getCameraName());
|
||||
|
||||
// 设备登录
|
||||
if (logonDeviceActive() != 0) {
|
||||
logger.error("摄像头 {} 登录失败", cameraConfig.getCameraName());
|
||||
return;
|
||||
}
|
||||
|
||||
// 开始抓拍
|
||||
if (startSnap() != 0) {
|
||||
logger.error("摄像头 {} 开始抓拍失败", cameraConfig.getCameraName());
|
||||
return;
|
||||
}
|
||||
|
||||
// 保持运行
|
||||
while (isRunning.get()) {
|
||||
try {
|
||||
// 检查登录状态
|
||||
if (logonID != -1) {
|
||||
int logonStatus = NetClient3.GetLogonStatus(logonID);
|
||||
if (logonStatus != NVSSDK2.LOGON_SUCCESS) {
|
||||
logger.warn("摄像头 {} 连接断开,尝试重新登录", cameraConfig.getCameraIP());
|
||||
reconnect();
|
||||
}
|
||||
}
|
||||
|
||||
Thread.sleep(5000); // 5秒检查一次
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("摄像头 {} 检测异常: {}", cameraConfig.getCameraIP(), e.getMessage(), e);
|
||||
} finally {
|
||||
stopDetection();
|
||||
}
|
||||
}
|
||||
|
||||
private int logonDevice() {
|
||||
logonID = NetClient2.Logon("",
|
||||
cameraConfig.getCameraIP(),
|
||||
cameraConfig.getUsername(),
|
||||
cameraConfig.getPassword(),
|
||||
"",
|
||||
cameraConfig.getPort());
|
||||
|
||||
// 等待登录成功
|
||||
int retryCount = 0;
|
||||
while (retryCount < 30 && isRunning.get()) {
|
||||
int logonStatus = NetClient2.GetLogonStatus(logonID);
|
||||
if (logonStatus == NVSSDK2.LOGON_SUCCESS) {
|
||||
logger.info("摄像头 {} 登录成功", cameraConfig.getCameraIP());
|
||||
return 0;
|
||||
} else if (logonStatus == NVSSDK2.LOGON_FAILED) {
|
||||
logger.error("摄像头 {} 登录失败", cameraConfig.getCameraIP());
|
||||
return -1;
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return -1;
|
||||
}
|
||||
retryCount++;
|
||||
}
|
||||
|
||||
logger.error("摄像头 {} 登录超时", cameraConfig.getCameraIP());
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int logonDeviceActive() {
|
||||
LoginRequest request = new LoginRequest();
|
||||
request.setIp(cameraConfig.getCameraIP());
|
||||
request.setPort(cameraConfig.getPort());
|
||||
request.setUsername(cameraConfig.getUsername());
|
||||
request.setPassword(cameraConfig.getPassword());
|
||||
request.setFactoryId(cameraConfig.getFactoryId());
|
||||
request.setLocalPort(cameraConfig.getLocalPort());
|
||||
Map<String, Object> resMap = deviceLoginService.loginActiveDevice(request);
|
||||
logonID = (int) resMap.get("logonId");
|
||||
|
||||
// 等待登录成功
|
||||
int retryCount = 0;
|
||||
while (retryCount < 30 && isRunning.get()) {
|
||||
int logonStatus = NetClient3.GetLogonStatus(logonID);
|
||||
if (logonStatus == NVSSDK2.LOGON_SUCCESS) {
|
||||
logger.info("摄像头 {} 登录成功", cameraConfig.getCameraIP());
|
||||
return 0;
|
||||
} else if (logonStatus == NVSSDK2.LOGON_FAILED) {
|
||||
logger.error("摄像头 {} 登录失败", cameraConfig.getCameraIP());
|
||||
return -1;
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return -1;
|
||||
}
|
||||
retryCount++;
|
||||
}
|
||||
|
||||
logger.error("摄像头 {} 登录超时", cameraConfig.getCameraIP());
|
||||
return -1;
|
||||
}
|
||||
|
||||
private void reconnect() {
|
||||
stopDetection();
|
||||
try {
|
||||
Thread.sleep(3000); // 等待3秒后重连
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isRunning.get()) {
|
||||
logger.info("尝试重新连接摄像头 {}", cameraConfig.getCameraIP());
|
||||
startDetection();
|
||||
}
|
||||
}
|
||||
|
||||
private int startSnap() {
|
||||
NVSSDK2.NetPicPara netPicParam = new NVSSDK2.NetPicPara();
|
||||
netPicParam.iStructLen = netPicParam.size();
|
||||
netPicParam.iChannelNo = cameraConfig.getChannelNo();
|
||||
netPicParam.cbkPicStreamNotify = new NVSSDK2.NET_PICSTREAM_NOTIFY() {
|
||||
public int PicDataNotify(int ulID, int lCommand, Pointer tInfo, int iLen, Pointer lpUserData) {
|
||||
return handlePicData(ulID, lCommand, tInfo, iLen, lpUserData);
|
||||
}
|
||||
};
|
||||
netPicParam.pvUser = null;
|
||||
|
||||
IntByReference pConnectID = new IntByReference();
|
||||
int iRet = NetClient2.StartRecvNetPicStream(logonID, netPicParam, netPicParam.size(), pConnectID);
|
||||
if (iRet < 0) {
|
||||
connectID = -1;
|
||||
logger.error("摄像头 {} 开始抓拍失败", cameraConfig.getCameraName());
|
||||
return -1;
|
||||
} else {
|
||||
connectID = pConnectID.getValue();
|
||||
logger.info("摄像头 {} 开始抓拍成功, ConnectID: {}", cameraConfig.getCameraName(), connectID);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private int handlePicData(int ulID, int lCommand, Pointer tInfo, int iLen, Pointer lpUserData) {
|
||||
if (lCommand != NVSSDK2.NET_PICSTREAM_CMD_ITS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
NVSSDK2.ItsPicStream itsPicStream = new NVSSDK2.ItsPicStream();
|
||||
itsPicStream.write();
|
||||
Pointer pItsBuffer = itsPicStream.getPointer();
|
||||
byte[] recvBuffer = tInfo.getByteArray(0, iLen);
|
||||
int copySize = Math.min(itsPicStream.size(), iLen);
|
||||
pItsBuffer.write(0, recvBuffer, 0, copySize);
|
||||
itsPicStream.read();
|
||||
|
||||
String licensePlate = new String(itsPicStream.cPlate).trim();
|
||||
|
||||
// 检测到车辆,生成告警
|
||||
if (!licensePlate.isEmpty() && !licensePlate.equals("未知")) {
|
||||
logger.info("摄像头 {} 检测到车辆: {}", cameraConfig.getCameraIP(), licensePlate);
|
||||
|
||||
// 创建告警记录
|
||||
createAlarmRecord(itsPicStream);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("摄像头 {} 处理图片数据异常: {}", cameraConfig.getCameraIP(), e.getMessage(), e);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void createAlarmRecord(NVSSDK2.ItsPicStream itsPicStream) {
|
||||
try {
|
||||
AlarmRecord alarm = new AlarmRecord();
|
||||
alarm.setCameraIP(cameraConfig.getCameraIP());
|
||||
alarm.setCameraName(cameraConfig.getCameraName());
|
||||
alarm.setLicensePlate(new String(itsPicStream.cPlate).trim());
|
||||
alarm.setChannelID(itsPicStream.iChannelID);
|
||||
alarm.setSpeed((double) itsPicStream.fSpeed);
|
||||
alarm.setAlarmType(itsPicStream.iAlarmType);
|
||||
alarm.setAlarmCode(new String(itsPicStream.cAlarmCode).trim());
|
||||
alarm.setAlarmTime(LocalDateTime.now());
|
||||
|
||||
// 设置车辆颜色
|
||||
if (itsPicStream.iCarColor >= 0 && itsPicStream.iCarColor < strCarColor.length) {
|
||||
alarm.setCarColor(strCarColor[itsPicStream.iCarColor]);
|
||||
} else {
|
||||
alarm.setCarColor("unknown");
|
||||
}
|
||||
|
||||
// 设置车牌颜色
|
||||
if (itsPicStream.iPlateColor >= 0 && itsPicStream.iPlateColor < strCarPlateColor.length) {
|
||||
alarm.setPlateColor(strCarPlateColor[itsPicStream.iPlateColor]);
|
||||
} else {
|
||||
alarm.setPlateColor("unknown");
|
||||
}
|
||||
|
||||
// 保存到数据库
|
||||
alarmRecordService.saveAlarmRecord(alarm);
|
||||
logger.info("摄像头 {} 告警记录保存成功: {}", cameraConfig.getCameraIP(), alarm.getLicensePlate());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("摄像头 {} 创建告警记录失败: {}", cameraConfig.getCameraIP(), e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return isRunning.get();
|
||||
}
|
||||
|
||||
public CameraConfig getCameraConfig() {
|
||||
return cameraConfig;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
if (!isRunning.get()) {
|
||||
return "STOPPED";
|
||||
}
|
||||
if (logonID == -1) {
|
||||
return "CONNECTING";
|
||||
}
|
||||
int logonStatus = NetClient2.GetLogonStatus(logonID);
|
||||
switch (logonStatus) {
|
||||
case NVSSDK2.LOGON_SUCCESS:
|
||||
return "RUNNING";
|
||||
case NVSSDK2.LOGON_ING:
|
||||
return "CONNECTING";
|
||||
case NVSSDK2.LOGON_FAILED:
|
||||
return "FAILED";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.whdc.service;
|
||||
|
||||
public interface IDeviceManager {
|
||||
void initSDK();
|
||||
Integer 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 m_iServerID,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);
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package com.whdc.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.whdc.entity.WqRReal;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 水质信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wanyan
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
public interface WqRRealService extends IService<WqRReal> {
|
||||
|
||||
List<WqRReal> getList();
|
||||
|
||||
Map<Boolean, List<WqRReal>> online();
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.whdc.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.whdc.entity.QueryDto;
|
||||
import com.whdc.entity.WqR;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 水质信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author wanyan
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
public interface WqRService extends IService<WqR> {
|
||||
|
||||
List<WqR> getList(QueryDto queryDto);
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.whdc.dto.AlarmRecordQuery;
|
||||
import com.whdc.entity.AlarmRecord;
|
||||
import com.whdc.mapper.AlarmRecordMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AlarmRecordService extends ServiceImpl<AlarmRecordMapper, AlarmRecord>
|
||||
{
|
||||
|
||||
public boolean saveAlarmRecord(AlarmRecord record) {
|
||||
return this.baseMapper.insert(record) > 0;
|
||||
}
|
||||
|
||||
public List<AlarmRecord> queryList(AlarmRecordQuery request) {
|
||||
LambdaQueryWrapper<AlarmRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if(request.getCameraIp() != null){
|
||||
queryWrapper.eq(AlarmRecord::getCameraIP,request.getCameraIp());
|
||||
}
|
||||
if(request.getStartTime() != null){
|
||||
queryWrapper.gt(AlarmRecord::getAlarmTime,request.getStartTime());
|
||||
}
|
||||
if(request.getEndTime() != null){
|
||||
queryWrapper.lt(AlarmRecord::getAlarmTime,request.getEndTime());
|
||||
}
|
||||
queryWrapper.orderByDesc(AlarmRecord::getAlarmTime);
|
||||
return this.baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.whdc.entity.CameraConfig;
|
||||
import com.whdc.mapper.CameraConfigMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CameraConfigService extends ServiceImpl<CameraConfigMapper, CameraConfig> {
|
||||
|
||||
|
||||
|
||||
public List<CameraConfig> getEnabledCameras() {
|
||||
LambdaQueryWrapper<CameraConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CameraConfig::getEnabled, 1);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,247 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.whdc.dto.LoginRequest;
|
||||
import com.whdc.syncjava.NVSSDK3;
|
||||
import com.whdc.syncjava.NetClient3;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class DeviceLoginService {
|
||||
|
||||
private Map<String, Integer> loginCache = new HashMap<>();
|
||||
|
||||
public Map<String, Object> loginActiveDevice(LoginRequest request) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
// 1. 初始化SDK
|
||||
// initializeSDK();
|
||||
|
||||
// 2. 设置本地端口
|
||||
int setPortResult = NetClient3.SetPort(request.getLocalPort(), 0);
|
||||
if (NVSSDK3.RET_SUCCESS != setPortResult) {
|
||||
result.put("success", false);
|
||||
result.put("message", "设置本地端口失败");
|
||||
return result;
|
||||
}
|
||||
// 3. 设置公网信息
|
||||
NVSSDK3.ActiveNetWanInfo wanInfo = new NVSSDK3.ActiveNetWanInfo();
|
||||
wanInfo.iSize = wanInfo.size();
|
||||
wanInfo.cWanIP = request.getIp().getBytes();
|
||||
wanInfo.iWanPort = request.getPort();
|
||||
wanInfo.write();
|
||||
|
||||
int dsmResult = NetClient3.SetDsmConfig(NVSSDK3.DSM_CMD_SET_NET_WAN_INFO,
|
||||
wanInfo.getPointer(), wanInfo.size());
|
||||
if (NVSSDK3.RET_SUCCESS != dsmResult) {
|
||||
result.put("success", false);
|
||||
result.put("message", "设置公网信息失败");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 4. 检查设备在线状态
|
||||
/**
|
||||
NVSSDK3.DsmOnline onlineInfo = new NVSSDK3.DsmOnline();
|
||||
onlineInfo.iSize = onlineInfo.size();
|
||||
onlineInfo.cProductID = request.getFactoryId().getBytes();
|
||||
onlineInfo.write();
|
||||
// 等待设备上线
|
||||
int timeout = 0;
|
||||
while (timeout < 30) {
|
||||
NetClient3.GetDsmRegstierInfo(NVSSDK3.DSM_CMD_GET_ONLINE_STATE,
|
||||
onlineInfo.getPointer(), onlineInfo.size());
|
||||
onlineInfo.read();
|
||||
if (NVSSDK3.DSM_STATE_ONLINE == onlineInfo.iOnline) {
|
||||
break;
|
||||
}
|
||||
|
||||
Thread.sleep(1000);
|
||||
timeout++;
|
||||
}
|
||||
|
||||
if (timeout >= 30) {
|
||||
result.put("success", false);
|
||||
result.put("message", "设备未注册或不在线");
|
||||
return result;
|
||||
}*/
|
||||
NVSSDK3.DsmOnline tOnline = new NVSSDK3.DsmOnline();
|
||||
tOnline.iSize = tOnline.size();
|
||||
tOnline.cProductID = request.getFactoryId().getBytes();
|
||||
tOnline.write();
|
||||
//Get the registration online status
|
||||
NetClient3.GetDsmRegstierInfo(NVSSDK3.DSM_CMD_GET_ONLINE_STATE, tOnline.getPointer(), tOnline.size());
|
||||
tOnline.read();
|
||||
int iOutTime = 0;
|
||||
while (NVSSDK3.DSM_STATE_ONLINE != tOnline.iOnline)
|
||||
{
|
||||
if (iOutTime >= 30)
|
||||
{
|
||||
System.out.println("Device not register!");
|
||||
result.put("success", false);
|
||||
result.put("message", "设备未注册或不在线");
|
||||
return result;
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.currentThread();
|
||||
Thread.sleep(1000);
|
||||
} catch(InterruptedException e) {
|
||||
System.err.println("Interrupted");
|
||||
}
|
||||
|
||||
NetClient3.GetDsmRegstierInfo(NVSSDK3.DSM_CMD_GET_ONLINE_STATE, tOnline.getPointer(), tOnline.size());
|
||||
tOnline.read();
|
||||
iOutTime++;
|
||||
}
|
||||
|
||||
// 5. 执行公网穿透登录
|
||||
NVSSDK3.LogonActiveServer activeLogon = new NVSSDK3.LogonActiveServer();
|
||||
activeLogon.iSize = activeLogon.size();
|
||||
activeLogon.cUserName = request.getUsername().getBytes();
|
||||
activeLogon.cUserPwd = request.getPassword().getBytes();
|
||||
activeLogon.cProductID = request.getFactoryId().getBytes();
|
||||
activeLogon.write();
|
||||
|
||||
int logonType = NVSSDK3.SERVER_ACTIVE;
|
||||
int logonId = NetClient3.SyncLogon(logonType, activeLogon.getPointer(), activeLogon.size());
|
||||
|
||||
// 6. 处理登录结果
|
||||
if (logonId >= 0) {
|
||||
String deviceKey = generateDeviceKey(request.getFactoryId(), "active");
|
||||
loginCache.put(deviceKey, logonId);
|
||||
|
||||
result.put("success", true);
|
||||
result.put("message", "公网设备登录成功");
|
||||
result.put("logonId", logonId);
|
||||
result.put("deviceKey", deviceKey);
|
||||
} else {
|
||||
String errorMsg = getLoginErrorMsg(logonId);
|
||||
result.put("success", false);
|
||||
result.put("message", errorMsg);
|
||||
result.put("errorCode", logonId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "公网登录异常: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String generateDeviceKey(String factoryId, String type) {
|
||||
return factoryId + ":" + type;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录错误信息
|
||||
*/
|
||||
private String getLoginErrorMsg(int errorCode) {
|
||||
switch (errorCode) {
|
||||
case NVSSDK3.RET_SYNCLOGON_TIMEOUT:
|
||||
return "登录超时,网络正常但设备无响应";
|
||||
case NVSSDK3.RET_SYNCLOGON_USENAME_ERROR:
|
||||
return "用户名错误";
|
||||
case NVSSDK3.RET_SYNCLOGON_USRPWD_ERROR:
|
||||
return "密码错误";
|
||||
case NVSSDK3.RET_SYNCLOGON_PWDERRTIMES_OVERRUN:
|
||||
return "密码错误次数超限,账户被锁定";
|
||||
case NVSSDK3.RET_SYNCLOGON_NET_ERROR:
|
||||
return "网络连接错误";
|
||||
case NVSSDK3.RET_SYNCLOGON_PORT_ERROR:
|
||||
return "通信端口错误";
|
||||
case NVSSDK3.RET_SYNCLOGON_UNKNOW_ERROR:
|
||||
return "未知错误";
|
||||
default:
|
||||
return "登录失败,错误码: " + errorCode;
|
||||
}
|
||||
}
|
||||
|
||||
public String initializeSDK() {
|
||||
// 检查SDK是否已初始化
|
||||
NVSSDK3.SDK_VERSION version = new NVSSDK3.SDK_VERSION();
|
||||
int versionResult = NetClient3.GetVersion(version);
|
||||
|
||||
if (versionResult == NVSSDK3.RET_SUCCESS) {
|
||||
System.out.println("SDK版本: " + version.m_cVerInfo);
|
||||
|
||||
// 设置回调函数
|
||||
NetClient3.SetNotifyFunction(getMainNotify(), getAlarmNotify(), getParaChangeNotify());
|
||||
|
||||
// 启动SDK
|
||||
int startup = NetClient3.Startup();
|
||||
System.out.println("startup="+startup);
|
||||
if(startup < 0){
|
||||
return "SDK初始化失败";
|
||||
}
|
||||
}
|
||||
return "SDK初始化完成";
|
||||
}
|
||||
|
||||
// 回调函数实现
|
||||
private NVSSDK3.MAIN_NOTIFY getMainNotify() {
|
||||
return new NVSSDK3.MAIN_NOTIFY() {
|
||||
@Override
|
||||
public void MainNotify(int logonID, int wParam, Pointer lParam, Pointer noitfyUserData) {
|
||||
System.out.println("主通知: LogonID=" + logonID + ", wParam=" + wParam);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private NVSSDK3.ALARM_NOTIFY getAlarmNotify() {
|
||||
return new NVSSDK3.ALARM_NOTIFY() {
|
||||
@Override
|
||||
public void AlarmNotify(int logonID, int channel, int alarmState, int alarmType, Pointer userData) {
|
||||
System.out.println("报警通知: LogonID=" + logonID + ", Channel=" + channel +
|
||||
", State=" + alarmState + ", Type=" + alarmType);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private NVSSDK3.PARACHANGE_NOTIFY getParaChangeNotify() {
|
||||
return new NVSSDK3.PARACHANGE_NOTIFY() {
|
||||
@Override
|
||||
public void ParaChangeNotify(int logonID, int channel, int paraType, Pointer para, Pointer noitfyUserData) {
|
||||
System.out.println("参数变更: LogonID=" + logonID + ", Channel=" + channel + ", Type=" + paraType);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备登录状态
|
||||
*/
|
||||
public Map<String, Object> getLoginStatus(String deviceKey) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
Integer logonId = loginCache.get(deviceKey);
|
||||
if (logonId != null) {
|
||||
int status = NetClient3.GetLogonStatus(logonId);
|
||||
result.put("success", true);
|
||||
result.put("logonId", logonId);
|
||||
result.put("status", status);
|
||||
result.put("statusDesc", getStatusDescription(status));
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "设备未登录");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取状态描述
|
||||
*/
|
||||
private String getStatusDescription(int status) {
|
||||
switch (status) {
|
||||
case 0: return "未登录";
|
||||
case 1: return "已登录";
|
||||
case 2: return "登录中";
|
||||
case 3: return "登录失败";
|
||||
default: return "未知状态";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,248 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.whdc.alarm.NVSSDK2;
|
||||
import com.whdc.alarm.NetClient2;
|
||||
import com.whdc.entity.CameraConfig;
|
||||
import com.whdc.service.CameraDetectionSession;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
public class MultiCameraDetectionService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(MultiCameraDetectionService.class);
|
||||
|
||||
@Value("${app.image-save-path}")
|
||||
private String imageSavePath;
|
||||
|
||||
@Autowired
|
||||
private CameraConfigService cameraConfigService;
|
||||
|
||||
@Autowired
|
||||
private AlarmRecordService alarmRecordService;
|
||||
|
||||
private final Map<Long, CameraDetectionSession> cameraSessions = new ConcurrentHashMap<>();
|
||||
private final Map<String, String[]> colorMappings = new ConcurrentHashMap<>();
|
||||
private ScheduledExecutorService scheduler;
|
||||
private boolean isServiceRunning = false;
|
||||
|
||||
@Autowired
|
||||
private DeviceLoginService deviceLoginService;
|
||||
|
||||
// @PostConstruct
|
||||
public void init() {
|
||||
initColorMappings();
|
||||
startService();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void destroy() {
|
||||
stopService();
|
||||
}
|
||||
|
||||
private void initColorMappings() {
|
||||
// 车牌颜色映射
|
||||
String[] strCarPlateColor = new String[NVSSDK2.MAX_CAR_PLATE_COLOR];
|
||||
strCarPlateColor[0] = "unknown";
|
||||
strCarPlateColor[1] = "white on blue";
|
||||
strCarPlateColor[2] = "black on yellow";
|
||||
strCarPlateColor[3] = "Black on white";
|
||||
strCarPlateColor[4] = "black and white";
|
||||
strCarPlateColor[5] = "white on green";
|
||||
|
||||
// 车辆颜色映射
|
||||
String[] strCarColor = new String[NVSSDK2.MAX_CAR_COLOR];
|
||||
strCarColor[0] = "white";
|
||||
strCarColor[1] = "red";
|
||||
strCarColor[2] = "yellow";
|
||||
strCarColor[3] = "gray";
|
||||
strCarColor[4] = "black";
|
||||
strCarColor[5] = "blue";
|
||||
strCarColor[6] = "green";
|
||||
// ... 其他颜色
|
||||
|
||||
colorMappings.put("plateColor", strCarPlateColor);
|
||||
colorMappings.put("carColor", strCarColor);
|
||||
|
||||
// SDK初始化(只需要一次)
|
||||
sdkInit();
|
||||
}
|
||||
|
||||
private void sdkInit() {
|
||||
NVSSDK2.SDK_VERSION ver = new NVSSDK2.SDK_VERSION();
|
||||
int iRet = NetClient2.GetVersion(ver);
|
||||
logger.info("SDK版本: {}", ver.m_cVerInfo);
|
||||
|
||||
// 设置回调函数
|
||||
iRet = NetClient2.SetNotifyFunction(
|
||||
new NVSSDK2.MAIN_NOTIFY() {
|
||||
public void MainNotify(int iLogonID, int wParam, Pointer lParam, Pointer noitfyUserData) {
|
||||
// 处理主通知
|
||||
}
|
||||
},
|
||||
new NVSSDK2.ALARM_NOTIFY() {
|
||||
public void AlarmNotify(int iLogonID, int iChannel, int iAlarmState, int iAlarmType, Pointer pUserData) {
|
||||
// 处理告警通知
|
||||
}
|
||||
},
|
||||
new NVSSDK2.PARACHANGE_NOTIFY() {
|
||||
public void ParaChangeNotify(int iLogonID, int iChannel, int paraType, Pointer para, Pointer noitfyUserData) {
|
||||
// 处理参数变化通知
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
logger.info("SDK通知函数设置: {}", iRet);
|
||||
|
||||
iRet = NetClient2.Startup();
|
||||
logger.info("SDK启动: {}", iRet);
|
||||
}
|
||||
|
||||
public void startService() {
|
||||
if (isServiceRunning) {
|
||||
return;
|
||||
}
|
||||
|
||||
isServiceRunning = true;
|
||||
scheduler = Executors.newScheduledThreadPool(1);
|
||||
|
||||
// 每30秒检查一次摄像头状态和配置
|
||||
scheduler.scheduleAtFixedRate(this::checkCameras, 0, 30, TimeUnit.SECONDS);
|
||||
|
||||
logger.info("多摄像头检测服务已启动");
|
||||
}
|
||||
|
||||
public void stopService() {
|
||||
isServiceRunning = false;
|
||||
|
||||
if (scheduler != null) {
|
||||
scheduler.shutdown();
|
||||
try {
|
||||
if (!scheduler.awaitTermination(10, TimeUnit.SECONDS)) {
|
||||
scheduler.shutdownNow();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
scheduler.shutdownNow();
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
// 停止所有摄像头检测
|
||||
cameraSessions.values().forEach(CameraDetectionSession::stopDetection);
|
||||
cameraSessions.clear();
|
||||
|
||||
NetClient2.Cleanup();
|
||||
logger.info("多摄像头检测服务已停止");
|
||||
}
|
||||
|
||||
private void checkCameras() {
|
||||
if (!isServiceRunning) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
List<CameraConfig> enabledCameras = cameraConfigService.getEnabledCameras();
|
||||
|
||||
// 启动新摄像头
|
||||
for (CameraConfig camera : enabledCameras) {
|
||||
if (!cameraSessions.containsKey(camera.getId())) {
|
||||
startCameraDetection(camera);
|
||||
}
|
||||
}
|
||||
|
||||
// 停止已禁用的摄像头
|
||||
cameraSessions.entrySet().removeIf(entry -> {
|
||||
Long cameraId = entry.getKey();
|
||||
CameraDetectionSession session = entry.getValue();
|
||||
|
||||
boolean shouldRemove = enabledCameras.stream()
|
||||
.noneMatch(camera -> camera.getId().equals(cameraId));
|
||||
|
||||
if (shouldRemove) {
|
||||
session.stopDetection();
|
||||
logger.info("摄像头 {} 检测已停止(配置已禁用)", session.getCameraConfig().getCameraIP());
|
||||
}
|
||||
|
||||
return shouldRemove;
|
||||
});
|
||||
|
||||
// 检查摄像头连接状态
|
||||
cameraSessions.forEach((id, session) -> {
|
||||
String status = session.getStatus();
|
||||
if ("FAILED".equals(status) || "STOPPED".equals(status)) {
|
||||
logger.warn("摄像头 {} 检测异常,状态: {}",
|
||||
session.getCameraConfig().getCameraIP(), status);
|
||||
// 自动重启
|
||||
session.stopDetection();
|
||||
session.startDetection();
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("检查摄像头状态异常: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void startCameraDetection(CameraConfig cameraConfig) {
|
||||
if (cameraSessions.containsKey(cameraConfig.getId())) {
|
||||
logger.warn("摄像头 {} 的检测已经在运行", cameraConfig.getCameraIP());
|
||||
return;
|
||||
}
|
||||
|
||||
CameraDetectionSession session = new CameraDetectionSession(
|
||||
cameraConfig,
|
||||
alarmRecordService,
|
||||
imageSavePath,
|
||||
colorMappings.get("plateColor"),
|
||||
colorMappings.get("carColor"),
|
||||
deviceLoginService
|
||||
);
|
||||
|
||||
cameraSessions.put(cameraConfig.getId(), session);
|
||||
session.startDetection();
|
||||
|
||||
logger.info("启动摄像头 {} 的车辆检测", cameraConfig.getCameraIP());
|
||||
}
|
||||
|
||||
public void stopCameraDetection(Long cameraId) {
|
||||
CameraDetectionSession session = cameraSessions.get(cameraId);
|
||||
if (session != null) {
|
||||
session.stopDetection();
|
||||
cameraSessions.remove(cameraId);
|
||||
logger.info("停止摄像头 {} 的车辆检测", session.getCameraConfig().getCameraIP());
|
||||
}
|
||||
}
|
||||
|
||||
public void restartCameraDetection(Long cameraId) {
|
||||
stopCameraDetection(cameraId);
|
||||
|
||||
CameraConfig cameraConfig = cameraConfigService.getById(cameraId);
|
||||
if (cameraConfig != null && cameraConfig.getEnabled() == 1) {
|
||||
startCameraDetection(cameraConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<Long, String> getCameraStatus() {
|
||||
Map<Long, String> statusMap = new ConcurrentHashMap<>();
|
||||
cameraSessions.forEach((id, session) -> {
|
||||
statusMap.put(id, session.getStatus());
|
||||
});
|
||||
return statusMap;
|
||||
}
|
||||
|
||||
public boolean isServiceRunning() {
|
||||
return isServiceRunning;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.whdc.dto.PlaybackRequest;
|
||||
import com.whdc.playback.NVSSDK;
|
||||
import com.whdc.playback.NetClient;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Service
|
||||
public class PlaybackService {
|
||||
|
||||
private Map<String, PlaybackSession> playbackSessions = new ConcurrentHashMap<>();
|
||||
|
||||
private static class PlaybackSession {
|
||||
String playbackId;
|
||||
int logonId;
|
||||
int connectId;
|
||||
String status; // "playing", "paused", "stopped", "error"
|
||||
Date startTime;
|
||||
PlaybackRequest request;
|
||||
|
||||
PlaybackSession(String playbackId, int logonId, PlaybackRequest request) {
|
||||
this.playbackId = playbackId;
|
||||
this.logonId = logonId;
|
||||
this.request = request;
|
||||
this.startTime = new Date();
|
||||
this.status = "playing";
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Object> startPlayback(PlaybackRequest request) {
|
||||
try {
|
||||
// 1. 登录设备
|
||||
// int logonId = loginDevice(request);
|
||||
int logonId = request.getM_iServerID();
|
||||
// 2. 启动回放
|
||||
String playbackId = generatePlaybackId();
|
||||
int connectId = startPlaybackStream(logonId, request);
|
||||
|
||||
// 3. 创建回放会话
|
||||
PlaybackSession session = new PlaybackSession(playbackId, logonId, request);
|
||||
session.connectId = connectId;
|
||||
playbackSessions.put(playbackId, session);
|
||||
|
||||
// 4. 返回结果
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("playbackId", playbackId);
|
||||
result.put("logonId", logonId);
|
||||
result.put("connectId", connectId);
|
||||
result.put("status", "playing");
|
||||
result.put("startTime", new Date());
|
||||
|
||||
return result;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("启动回放失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean stopPlayback(String playbackId) {
|
||||
PlaybackSession session = playbackSessions.get(playbackId);
|
||||
if (session == null) {
|
||||
throw new RuntimeException("回放会话不存在: " + playbackId);
|
||||
}
|
||||
|
||||
try {
|
||||
// 停止下载
|
||||
NetClient.NetFileStopDownloadFile(session.connectId);
|
||||
|
||||
// 登出设备
|
||||
NetClient.Logoff(session.logonId);
|
||||
|
||||
// 更新状态
|
||||
session.status = "stopped";
|
||||
playbackSessions.remove(playbackId);
|
||||
|
||||
return true;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("停止回放失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, Object> getPlaybackStatus(String playbackId) {
|
||||
PlaybackSession session = playbackSessions.get(playbackId);
|
||||
if (session == null) {
|
||||
throw new RuntimeException("回放会话不存在: " + playbackId);
|
||||
}
|
||||
|
||||
try {
|
||||
// 获取下载进度
|
||||
IntByReference progress = new IntByReference();
|
||||
IntByReference downloadSize = new IntByReference();
|
||||
NetClient.NetFileGetDownloadPos(session.connectId, progress, downloadSize);
|
||||
|
||||
Map<String, Object> status = new HashMap<>();
|
||||
status.put("playbackId", playbackId);
|
||||
status.put("status", session.status);
|
||||
status.put("progress", progress.getValue());
|
||||
status.put("downloadSize", downloadSize.getValue());
|
||||
status.put("startTime", session.startTime);
|
||||
status.put("currentTime", new Date());
|
||||
|
||||
return status;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("获取回放状态失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private int loginDevice(PlaybackRequest request) {
|
||||
// int logonId = NetClient.Logon("", request.getDeviceIp(),
|
||||
// request.getUsername(), request.getPassword(),
|
||||
// "", request.getDevicePort());
|
||||
//
|
||||
// if (logonId < 0) {
|
||||
// throw new RuntimeException("设备登录失败,错误码: " + logonId);
|
||||
// }
|
||||
//
|
||||
// // 等待登录成功
|
||||
// int retryCount = 0;
|
||||
// while (retryCount < 10) {
|
||||
// int status = NetClient.GetLogonStatus(logonId);
|
||||
// if (status == NVSSDK.LOGON_SUCCESS) {
|
||||
// return logonId;
|
||||
// }
|
||||
// try {
|
||||
// Thread.sleep(1000);
|
||||
// retryCount++;
|
||||
// } catch (InterruptedException e) {
|
||||
// Thread.currentThread().interrupt();
|
||||
// throw new RuntimeException("登录等待被中断");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// throw new RuntimeException("设备登录超时");
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int startPlaybackStream(int logonId, PlaybackRequest request) {
|
||||
try {
|
||||
NVSSDK.DOWNLOAD_TIMESPAN downloadTimespan = new NVSSDK.DOWNLOAD_TIMESPAN();
|
||||
downloadTimespan.m_iSize = downloadTimespan.size();
|
||||
|
||||
// 设置本地文件名
|
||||
String localFileName = "playback_" + System.currentTimeMillis() + ".sdv";
|
||||
downloadTimespan.m_cLocalFilename = localFileName.getBytes();
|
||||
|
||||
downloadTimespan.m_iChannelNO = request.getChannelNo();
|
||||
downloadTimespan.m_iStreamNo = request.getStreamType();
|
||||
downloadTimespan.m_iSaveFileType = 0; // SDV格式
|
||||
|
||||
// 设置时间范围
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(request.getStartTime());
|
||||
downloadTimespan.m_tTimeBegin.iYear = (short) cal.get(Calendar.YEAR);
|
||||
downloadTimespan.m_tTimeBegin.iMonth = (short) (cal.get(Calendar.MONTH) + 1);
|
||||
downloadTimespan.m_tTimeBegin.iDay = (short) cal.get(Calendar.DAY_OF_MONTH);
|
||||
downloadTimespan.m_tTimeBegin.iHour = (short) cal.get(Calendar.HOUR_OF_DAY);
|
||||
downloadTimespan.m_tTimeBegin.iMinute = (short) cal.get(Calendar.MINUTE);
|
||||
downloadTimespan.m_tTimeBegin.iSecond = (short) cal.get(Calendar.SECOND);
|
||||
|
||||
cal.setTime(request.getEndTime());
|
||||
downloadTimespan.m_tTimeEnd.iYear = (short) cal.get(Calendar.YEAR);
|
||||
downloadTimespan.m_tTimeEnd.iMonth = (short) (cal.get(Calendar.MONTH) + 1);
|
||||
downloadTimespan.m_tTimeEnd.iDay = (short) cal.get(Calendar.DAY_OF_MONTH);
|
||||
downloadTimespan.m_tTimeEnd.iHour = (short) cal.get(Calendar.HOUR_OF_DAY);
|
||||
downloadTimespan.m_tTimeEnd.iMinute = (short) cal.get(Calendar.MINUTE);
|
||||
downloadTimespan.m_tTimeEnd.iSecond = (short) cal.get(Calendar.SECOND);
|
||||
|
||||
downloadTimespan.m_iPosition = -1; // 不使用定位
|
||||
downloadTimespan.m_iSpeed = request.getSpeed();
|
||||
downloadTimespan.m_iReqMode = 1; // 帧模式
|
||||
downloadTimespan.write();
|
||||
|
||||
IntByReference connectId = new IntByReference();
|
||||
int result = NetClient.NetFileDownload(connectId, logonId,
|
||||
NVSSDK.DOWNLOAD_CMD_TIMESPAN,
|
||||
downloadTimespan.getPointer(),
|
||||
downloadTimespan.size());
|
||||
|
||||
if (result == 0) {
|
||||
return connectId.getValue();
|
||||
} else {
|
||||
throw new RuntimeException("启动回放流失败,错误码: " + result);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("启动回放流异常: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private String generatePlaybackId() {
|
||||
return "playback_" + System.currentTimeMillis() + "_" +
|
||||
Math.abs((int)(Math.random() * 10000));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.whdc.entity.AlarmRecord;
|
||||
import com.whdc.entity.User;
|
||||
import com.whdc.mapper.AlarmRecordMapper;
|
||||
import com.whdc.mapper.UserMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class UserService extends ServiceImpl<UserMapper, User>
|
||||
{
|
||||
|
||||
|
||||
public User login(String username, String password) {
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(User::getUserName, username).eq(User::getPassword, password);
|
||||
User user = getOne(queryWrapper);
|
||||
if (user == null) {
|
||||
throw new RuntimeException("用户名或密码错误");
|
||||
}
|
||||
if ("1".equals(user.getStatus())) {
|
||||
throw new RuntimeException("用户已被停用");
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,311 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.whdc.alarm.NVSSDK2;
|
||||
import com.whdc.alarm.NetClient2;
|
||||
import com.whdc.entity.AlarmRecord;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class VehicleDetectionService {
|
||||
|
||||
@Value("${app.image-save-path}")
|
||||
private String imageSavePath;
|
||||
|
||||
@Autowired
|
||||
private AlarmRecordService alarmRecordService;
|
||||
|
||||
private int m_iLogonID = -1;
|
||||
private int m_iConnectID = -1;
|
||||
private boolean isRunning = false;
|
||||
private ExecutorService executorService;
|
||||
|
||||
private String[] strCarPlateColor = new String[NVSSDK2.MAX_CAR_PLATE_COLOR];
|
||||
private String[] strCarColor = new String[NVSSDK2.MAX_CAR_COLOR];
|
||||
|
||||
// @PostConstruct
|
||||
public void init() {
|
||||
executorService = Executors.newSingleThreadExecutor();
|
||||
initValueString();
|
||||
createImageDirectory();
|
||||
startDetection();
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void destroy() {
|
||||
stopDetection();
|
||||
if (executorService != null) {
|
||||
executorService.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private void initValueString() {
|
||||
strCarPlateColor[0] = "unknown";
|
||||
strCarPlateColor[1] = "white on blue";
|
||||
strCarPlateColor[2] = "black on yellow";
|
||||
strCarPlateColor[3] = "Black on white";
|
||||
strCarPlateColor[4] = "black and white";
|
||||
strCarPlateColor[5] = "white on green";
|
||||
|
||||
strCarColor[0] = "white";
|
||||
strCarColor[1] = "red";
|
||||
strCarColor[2] = "yellow";
|
||||
// ... 其他颜色定义
|
||||
}
|
||||
|
||||
private void createImageDirectory() {
|
||||
File dir = new File(imageSavePath);
|
||||
if (!dir.exists()) {
|
||||
if (dir.mkdirs()) {
|
||||
System.out.println("创建图片保存目录成功: " + imageSavePath);
|
||||
} else {
|
||||
System.err.println("创建图片保存目录失败: " + imageSavePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void startDetection() {
|
||||
if (isRunning) {
|
||||
return;
|
||||
}
|
||||
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
isRunning = true;
|
||||
System.out.println("开始车辆检测...");
|
||||
|
||||
// SDK初始化
|
||||
if (sdkInit() != 0) {
|
||||
System.err.println("SDK初始化失败");
|
||||
return;
|
||||
}
|
||||
|
||||
// 设备登录(这里需要根据实际情况配置)
|
||||
if (logonDevice("192.168.1.100", "admin", "password", 3000) != 0) {
|
||||
System.err.println("设备登录失败");
|
||||
return;
|
||||
}
|
||||
|
||||
// 开始抓拍
|
||||
startSnap();
|
||||
|
||||
// 保持运行
|
||||
while (isRunning) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("车辆检测服务异常: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
stopDetection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void stopDetection() {
|
||||
isRunning = false;
|
||||
if (m_iConnectID != -1) {
|
||||
NetClient2.StopRecv(m_iConnectID);
|
||||
m_iConnectID = -1;
|
||||
}
|
||||
if (m_iLogonID != -1) {
|
||||
NetClient2.Logoff(m_iLogonID);
|
||||
m_iLogonID = -1;
|
||||
}
|
||||
NetClient2.Cleanup();
|
||||
System.out.println("车辆检测服务已停止");
|
||||
}
|
||||
|
||||
private int sdkInit() {
|
||||
NVSSDK2.SDK_VERSION ver = new NVSSDK2.SDK_VERSION();
|
||||
int iRet = NetClient2.GetVersion(ver);
|
||||
System.out.println("[SDK_VERSION]" + ver.m_cVerInfo);
|
||||
|
||||
// 设置回调函数
|
||||
iRet = NetClient2.SetNotifyFunction(
|
||||
new NVSSDK2.MAIN_NOTIFY() {
|
||||
public void MainNotify(int iLogonID, int wParam, Pointer lParam, Pointer noitfyUserData) {
|
||||
// 处理主通知
|
||||
}
|
||||
},
|
||||
new NVSSDK2.ALARM_NOTIFY() {
|
||||
public void AlarmNotify(int iLogonID, int iChannel, int iAlarmState, int iAlarmType, Pointer pUserData) {
|
||||
// 处理告警通知
|
||||
}
|
||||
},
|
||||
new NVSSDK2.PARACHANGE_NOTIFY() {
|
||||
public void ParaChangeNotify(int iLogonID, int iChannel, int paraType, Pointer para, Pointer noitfyUserData) {
|
||||
// 处理参数变化通知
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
System.out.println("SetNotifyFunction(" + iRet + ")");
|
||||
|
||||
iRet = NetClient2.Startup();
|
||||
System.out.println("Startup(" + iRet + ")");
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
private int logonDevice(String ip, String username, String password, int port) {
|
||||
m_iLogonID = NetClient2.Logon("", ip, username, password, "", port);
|
||||
|
||||
// 等待登录成功
|
||||
int retryCount = 0;
|
||||
while (retryCount < 30) {
|
||||
int logonStatus = NetClient2.GetLogonStatus(m_iLogonID);
|
||||
if (logonStatus == NVSSDK2.LOGON_SUCCESS) {
|
||||
log.info("设备登录成功: {}", ip);
|
||||
return 0;
|
||||
} else if (logonStatus == NVSSDK2.LOGON_FAILED) {
|
||||
System.err.println("设备登录失败: " + ip);
|
||||
return -1;
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return -1;
|
||||
}
|
||||
retryCount++;
|
||||
}
|
||||
|
||||
System.err.println("设备登录超时: " + ip);
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int startSnap() {
|
||||
NVSSDK2.NetPicPara tNetPicParam = new NVSSDK2.NetPicPara();
|
||||
tNetPicParam.iStructLen = tNetPicParam.size();
|
||||
tNetPicParam.iChannelNo = 0;
|
||||
tNetPicParam.cbkPicStreamNotify = new NVSSDK2.NET_PICSTREAM_NOTIFY() {
|
||||
public int PicDataNotify(int ulID, int lCommand, Pointer tInfo, int iLen, Pointer lpUserData) {
|
||||
return handlePicData(ulID, lCommand, tInfo, iLen, lpUserData);
|
||||
}
|
||||
};
|
||||
tNetPicParam.pvUser = null;
|
||||
|
||||
IntByReference pConnectID = new IntByReference();
|
||||
int iRet = NetClient2.StartRecvNetPicStream(m_iLogonID, tNetPicParam, tNetPicParam.size(), pConnectID);
|
||||
if (iRet < 0) {
|
||||
m_iConnectID = -1;
|
||||
System.out.println("StartRecvNetPicStream Failed!");
|
||||
return -1;
|
||||
} else {
|
||||
m_iConnectID = pConnectID.getValue();
|
||||
System.out.println("StartRecvNetPicStream Success! ConnectID(" + m_iConnectID + ")");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private int handlePicData(int ulID, int lCommand, Pointer tInfo, int iLen, Pointer lpUserData) {
|
||||
if (lCommand != NVSSDK2.NET_PICSTREAM_CMD_ITS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
NVSSDK2.ItsPicStream tItsPicStream = new NVSSDK2.ItsPicStream();
|
||||
tItsPicStream.write();
|
||||
Pointer pItsBuffer = tItsPicStream.getPointer();
|
||||
byte[] RecvBuffer = tInfo.getByteArray(0, iLen);
|
||||
int iCopySize = Math.min(tItsPicStream.size(), iLen);
|
||||
pItsBuffer.write(0, RecvBuffer, 0, iCopySize);
|
||||
tItsPicStream.read();
|
||||
|
||||
String strIP = new String(tItsPicStream.cCameraIP).trim();
|
||||
String strPlate = new String(tItsPicStream.cPlate).trim();
|
||||
|
||||
// 检测到车辆,生成告警
|
||||
if (!strPlate.isEmpty() && !strPlate.equals("未知")) {
|
||||
log.info("检测到车辆闯入: {}, IP: {}", strPlate, strIP);
|
||||
|
||||
// 保存图片
|
||||
String imageFileName = saveVehicleImage(tItsPicStream);
|
||||
|
||||
// 创建告警记录
|
||||
createAlarmRecord(tItsPicStream, imageFileName);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("处理图片数据异常: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private String saveVehicleImage(NVSSDK2.ItsPicStream tItsPicStream) {
|
||||
String fileName = "vehicle_" + System.currentTimeMillis() + "_" +
|
||||
new String(tItsPicStream.cPlate).trim() + ".jpg";
|
||||
String filePath = imageSavePath + File.separator + fileName;
|
||||
|
||||
// 这里简化图片保存逻辑,实际需要根据SDK的图片数据结构来保存
|
||||
try {
|
||||
// 实际实现需要根据tItsPicStream中的图片数据来保存
|
||||
log.info("保存车辆图片: " + filePath);
|
||||
return fileName;
|
||||
} catch (Exception e) {
|
||||
System.err.println("保存车辆图片失败: " + e.getMessage());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private void createAlarmRecord(NVSSDK2.ItsPicStream tItsPicStream, String imageFileName) {
|
||||
try {
|
||||
AlarmRecord alarm = new AlarmRecord();
|
||||
alarm.setCameraIP(new String(tItsPicStream.cCameraIP).trim());
|
||||
alarm.setLicensePlate(new String(tItsPicStream.cPlate).trim());
|
||||
alarm.setChannelID(tItsPicStream.iChannelID);
|
||||
alarm.setSpeed((double) tItsPicStream.fSpeed);
|
||||
alarm.setAlarmType(tItsPicStream.iAlarmType);
|
||||
alarm.setAlarmCode(new String(tItsPicStream.cAlarmCode).trim());
|
||||
alarm.setImagePath(imageFileName);
|
||||
alarm.setAlarmTime(LocalDateTime.now());
|
||||
|
||||
// 设置车辆颜色
|
||||
if (tItsPicStream.iCarColor >= 0 && tItsPicStream.iCarColor < strCarColor.length) {
|
||||
alarm.setCarColor(strCarColor[tItsPicStream.iCarColor]);
|
||||
} else {
|
||||
alarm.setCarColor("unknown");
|
||||
}
|
||||
|
||||
// 设置车牌颜色
|
||||
if (tItsPicStream.iPlateColor >= 0 && tItsPicStream.iPlateColor < strCarPlateColor.length) {
|
||||
alarm.setPlateColor(strCarPlateColor[tItsPicStream.iPlateColor]);
|
||||
} else {
|
||||
alarm.setPlateColor("unknown");
|
||||
}
|
||||
|
||||
// 保存到数据库
|
||||
alarmRecordService.saveAlarmRecord(alarm);
|
||||
log.info("告警记录保存成功: {}", alarm.getLicensePlate());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("创建告警记录失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return isRunning;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,636 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.whdc.video.NVSSDK1;
|
||||
import com.whdc.video.NetClient1;
|
||||
import com.whdc.websocket.FLVEncoder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class VideoPlayService {
|
||||
|
||||
private boolean sdkInitialized = false;
|
||||
private Map<String, StreamSession> activeSessions = new ConcurrentHashMap<>();
|
||||
private Map<Integer, StreamSession> logonSessions = new ConcurrentHashMap<>();
|
||||
private Map<Integer, StreamSession> connectIdSessions = new ConcurrentHashMap<>();
|
||||
|
||||
// 添加全局回调实例防止被GC回收
|
||||
private NVSSDK1.MAIN_NOTIFY mainNotifyCallback;
|
||||
private NVSSDK1.ALARM_NOTIFY alarmNotifyCallback;
|
||||
private NVSSDK1.PARACHANGE_NOTIFY paraChangeNotifyCallback;
|
||||
|
||||
public static interface FrameCallback {
|
||||
void onFrame(byte[] frameData, int frameType);
|
||||
}
|
||||
|
||||
private static class StreamSession {
|
||||
String streamId;
|
||||
int logonId;
|
||||
int connectId;
|
||||
FrameCallback frameCallback;
|
||||
NVSSDK1.NVSDATA_NOTIFY dataNotify;
|
||||
NVSSDK1.RAWFRAME_NOTIFY rawFrameNotify;
|
||||
NVSSDK1.DECYUV_NOTIFY_V4 decYuvNotify;
|
||||
|
||||
// FLV相关字段
|
||||
byte[] sps; // 序列参数集
|
||||
byte[] pps; // 图像参数集
|
||||
boolean flvHeaderSent = false; // FLV头是否已发送
|
||||
AtomicLong timestamp = new AtomicLong(0); // 时间戳
|
||||
int frameCount = 0; // 帧计数
|
||||
boolean hasKeyFrame = false; // 是否收到关键帧
|
||||
|
||||
StreamSession(String streamId) {
|
||||
this.streamId = streamId;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean initSDK() {
|
||||
try {
|
||||
if (sdkInitialized) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 获取SDK版本
|
||||
NVSSDK1.SDK_VERSION ver = new NVSSDK1.SDK_VERSION();
|
||||
int iRet = NetClient1.GetVersion(ver);
|
||||
log.info("[SDK_VERSION] {}", new String(ver.m_cVerInfo).trim());
|
||||
|
||||
// 创建并保持全局回调引用
|
||||
mainNotifyCallback = new NVSSDK1.MAIN_NOTIFY() {
|
||||
@Override
|
||||
public void MainNotify(int iLogonID, int wParam, Pointer lParam, Pointer noitfyUserData) {
|
||||
try {
|
||||
int iMsgType = wParam & 0xFFFF;
|
||||
log.debug("主通知 - LogonID: {}, MsgType: 0x{}", iLogonID, Integer.toHexString(iMsgType));
|
||||
|
||||
switch (iMsgType) {
|
||||
case NVSSDK1.WCM_LOGON_NOTIFY:
|
||||
handleLogonNotify(iLogonID);
|
||||
break;
|
||||
case NVSSDK1.WCM_QUERYFILE_FINISHED:
|
||||
log.info("文件查询完成");
|
||||
break;
|
||||
case NVSSDK1.WCM_DWONLOAD_FINISHED:
|
||||
log.info("文件下载完成");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("主通知处理异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
alarmNotifyCallback = new NVSSDK1.ALARM_NOTIFY() {
|
||||
@Override
|
||||
public void AlarmNotify(int _iLogonID, int _iChannel, int _iAlarmState, int _iAlarmType, Pointer _pUserData) {
|
||||
log.debug("报警通知 - LogonID: {}, Channel: {}, AlarmType: {}", _iLogonID, _iChannel, _iAlarmType);
|
||||
}
|
||||
};
|
||||
|
||||
paraChangeNotifyCallback = new NVSSDK1.PARACHANGE_NOTIFY() {
|
||||
@Override
|
||||
public void ParaChangeNotify(int iLogonID, int iChannel, int paraType, Pointer para, Pointer noitfyUserData) {
|
||||
log.debug("参数变化 - LogonID: {}, Channel: {}, ParaType: {}", iLogonID, iChannel, paraType);
|
||||
}
|
||||
};
|
||||
|
||||
// 设置通知回调
|
||||
iRet = NetClient1.SetNotifyFunction(mainNotifyCallback, alarmNotifyCallback, paraChangeNotifyCallback);
|
||||
log.info("SetNotifyFunction({})", iRet);
|
||||
|
||||
// 启动SDK
|
||||
iRet = NetClient1.Startup();
|
||||
log.info("Startup({})", iRet);
|
||||
|
||||
sdkInitialized = (iRet == NVSSDK1.RET_SUCCESS);
|
||||
return sdkInitialized;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("SDK初始化异常: {}", e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleLogonNotify(int logonId) {
|
||||
try {
|
||||
int logonStatus = NetClient1.GetLogonStatus(logonId);
|
||||
log.info("登录状态通知 - LogonID: {}, Status: {}", logonId, logonStatus);
|
||||
|
||||
// 更新对应会话的登录状态
|
||||
for (StreamSession session : logonSessions.values()) {
|
||||
if (session.logonId == logonId) {
|
||||
log.info("找到对应会话: {}", session.streamId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("处理登录通知异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public int login(String ip, int port, String username, String password) {
|
||||
try {
|
||||
if (!sdkInitialized) {
|
||||
if (!initSDK()) {
|
||||
throw new RuntimeException("SDK初始化失败");
|
||||
}
|
||||
}
|
||||
|
||||
NVSSDK1.LogonPara logonPara = new NVSSDK1.LogonPara();
|
||||
logonPara.iSize = logonPara.size();
|
||||
|
||||
// 正确设置字节数组
|
||||
byte[] ipBytes = new byte[64];
|
||||
byte[] ipSource = ip.getBytes();
|
||||
System.arraycopy(ipSource, 0, ipBytes, 0, Math.min(ipSource.length, 63));
|
||||
logonPara.cNvsIP = ipBytes;
|
||||
|
||||
logonPara.iNvsPort = port;
|
||||
|
||||
byte[] userBytes = new byte[64];
|
||||
byte[] userSource = username.getBytes();
|
||||
System.arraycopy(userSource, 0, userBytes, 0, Math.min(userSource.length, 63));
|
||||
logonPara.cUserName = userBytes;
|
||||
|
||||
byte[] pwdBytes = new byte[64];
|
||||
byte[] pwdSource = password.getBytes();
|
||||
System.arraycopy(pwdSource, 0, pwdBytes, 0, Math.min(pwdSource.length, 63));
|
||||
logonPara.cUserPwd = pwdBytes;
|
||||
|
||||
logonPara.write();
|
||||
|
||||
int logonId = NetClient1.Logon_V4(NVSSDK1.SERVER_NORMAL, logonPara.getPointer(), logonPara.size());
|
||||
|
||||
if (logonId < 0) {
|
||||
throw new RuntimeException("登录失败, 错误码: " + logonId);
|
||||
}
|
||||
|
||||
log.info("登录请求发送成功, LogonID: {}, 等待异步回调...", logonId);
|
||||
return logonId;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("登录异常: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public String startStream(int logonId, int channelNo, int streamType, int netMode) {
|
||||
return startStream(logonId, channelNo, streamType, netMode, null);
|
||||
}
|
||||
|
||||
public String startStream(int logonId, int channelNo, int streamType, int netMode, FrameCallback frameCallback) {
|
||||
try {
|
||||
// 创建流会话
|
||||
String streamId = generateStreamId();
|
||||
StreamSession session = new StreamSession(streamId);
|
||||
session.logonId = logonId;
|
||||
if (frameCallback != null) {
|
||||
session.frameCallback = frameCallback;
|
||||
} else {
|
||||
// 创建一个默认的回调,用于记录日志
|
||||
session.frameCallback = new FrameCallback() {
|
||||
@Override
|
||||
public void onFrame(byte[] frameData, int frameType) {
|
||||
log.debug("默认帧回调 - StreamID: {}, FrameType: {}, DataSize: {}",
|
||||
streamId, frameType, frameData != null ? frameData.length : 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 启动视频流接收
|
||||
NVSSDK1.CLIENTINFO clientInfo = new NVSSDK1.CLIENTINFO();
|
||||
clientInfo.m_iChannelNo = channelNo;
|
||||
clientInfo.m_iNetMode = netMode;
|
||||
clientInfo.m_iStreamNO = streamType;
|
||||
clientInfo.m_iServerID = logonId;
|
||||
clientInfo.m_iBufferCount = 20;
|
||||
clientInfo.m_iDelayNum = 1;
|
||||
clientInfo.m_iTimeout = 2000;
|
||||
clientInfo.m_iTTL = 8;
|
||||
clientInfo.write();
|
||||
|
||||
IntByReference piConnectID = new IntByReference();
|
||||
|
||||
// 创建并保持数据回调引用
|
||||
session.dataNotify = new NVSSDK1.NVSDATA_NOTIFY() {
|
||||
@Override
|
||||
public void NvsDataNotify(int _uiID, Pointer _pucData, int _iLen, Pointer _iUser) {
|
||||
handleDataNotify(_uiID, _pucData, _iLen, 0);
|
||||
}
|
||||
};
|
||||
|
||||
// 创建并保持原始帧回调引用
|
||||
session.rawFrameNotify = new NVSSDK1.RAWFRAME_NOTIFY() {
|
||||
@Override
|
||||
public void rawFrameNotify(int _uiID, Pointer _pcData, int _iLen,
|
||||
NVSSDK1.RAWFRAME_INFO _ptRawFrameInfo, Pointer _pvUsrData) {
|
||||
handleRawFrameNotify(_uiID, _pcData, _iLen, _ptRawFrameInfo);
|
||||
}
|
||||
};
|
||||
|
||||
// 创建解码回调(可选)
|
||||
session.decYuvNotify = new NVSSDK1.DECYUV_NOTIFY_V4() {
|
||||
@Override
|
||||
public void decYuvNotify(int _uiID, Pointer _pcData, int _iLen,
|
||||
NVSSDK1.FRAME_INFO _pFrameInfo, Pointer _pvUser) {
|
||||
handleDecYuvNotify(_uiID, _pcData, _iLen, _pFrameInfo);
|
||||
}
|
||||
};
|
||||
|
||||
int iRet = NetClient1.StartRecv_V4(piConnectID, clientInfo, session.dataNotify, null);
|
||||
if (iRet < 0) {
|
||||
throw new RuntimeException("启动视频流接收失败, 错误码: " + iRet);
|
||||
}
|
||||
|
||||
int connectId = piConnectID.getValue();
|
||||
session.connectId = connectId;
|
||||
|
||||
// 保存连接到会话映射
|
||||
connectIdSessions.put(connectId, session);
|
||||
|
||||
// 开始捕获数据
|
||||
NetClient1.StartCaptureData(connectId);
|
||||
|
||||
// 设置原始帧回调
|
||||
NetClient1.SetRawFrameCallBack(connectId, session.rawFrameNotify, null);
|
||||
|
||||
// 设置解码回调(如果需要解码数据)
|
||||
NetClient1.SetDecCallBack_V4(connectId, session.decYuvNotify, null);
|
||||
|
||||
// 开始播放(不需要显示窗口)
|
||||
NetClient1.StartPlay(connectId, null, 0);
|
||||
|
||||
// 保存会话
|
||||
activeSessions.put(streamId, session);
|
||||
logonSessions.put(logonId, session);
|
||||
|
||||
log.info("视频流启动成功, StreamID: {}, ConnectID: {}, LogonID: {}",
|
||||
streamId, connectId, logonId);
|
||||
return streamId;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("启动视频流异常: {}", e.getMessage(), e);
|
||||
throw new RuntimeException("启动视频流异常: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleDataNotify(int connectId, Pointer data, int len, int frameType) {
|
||||
try {
|
||||
if (len > 0) {
|
||||
StreamSession session = connectIdSessions.get(connectId);
|
||||
if (session != null && session.frameCallback != null) {
|
||||
byte[] frameData = data.getByteArray(0, len);
|
||||
session.frameCallback.onFrame(frameData, frameType);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("数据通知处理异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRawFrameNotify(int connectId, Pointer data, int len, NVSSDK1.RAWFRAME_INFO frameInfo) {
|
||||
// try {
|
||||
// if (len > 0 && (frameInfo.nType == NVSSDK1.VI_FRAME || frameInfo.nType == NVSSDK1.VP_FRAME)) {
|
||||
// StreamSession session = connectIdSessions.get(connectId);
|
||||
// if (session != null && session.frameCallback != null) {
|
||||
// byte[] frameData = data.getByteArray(0, len);
|
||||
// session.frameCallback.onFrame(frameData, frameInfo.nType);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("原始帧通知处理异常: {}", e.getMessage());
|
||||
// }
|
||||
try {
|
||||
if (len <= 0) {
|
||||
log.info("收到空帧 - ConnectID: {}, Len: {}", connectId, len);
|
||||
return;
|
||||
}
|
||||
|
||||
StreamSession session = connectIdSessions.get(connectId);
|
||||
if (session == null) {
|
||||
log.info("未找到对应会话 - ConnectID: {}", connectId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (session.frameCallback == null) {
|
||||
log.info("会话没有设置回调 - StreamID: {}", session.streamId);
|
||||
return;
|
||||
}
|
||||
// 打印帧信息
|
||||
// log.info("收到视频帧 - ConnectID: {}, StreamID: {}, Type: {}, Len: {}, Timestamp: {}",
|
||||
// connectId, session.streamId, frameInfo.nType, len, frameInfo.nStamp);
|
||||
byte[] frameData = data.getByteArray(0, len);
|
||||
|
||||
// 只处理视频帧
|
||||
if (frameInfo.nType == NVSSDK1.VI_FRAME || frameInfo.nType == NVSSDK1.VP_FRAME) {
|
||||
// 更新会话时间戳
|
||||
long currentTime = session.timestamp.addAndGet(40); // 每帧增加40ms(25fps)
|
||||
// log.info("处理视频帧 - StreamID: {}, CurrentTime: {}",
|
||||
// session.streamId, currentTime);
|
||||
// 提取NALU
|
||||
List<byte[]> nalus = FLVEncoder.H264NaluParser.extractNalus(frameData);
|
||||
|
||||
if (nalus.isEmpty()) {
|
||||
// 如果没有起始码,可能是单个NALU
|
||||
log.info("未找到NALU起始码,尝试处理为单个NALU");
|
||||
processSingleNalu(session, frameData, frameInfo, currentTime);
|
||||
} else {
|
||||
// 处理每个NALU
|
||||
// log.info("找到 {} 个NALU", nalus.size());
|
||||
for (byte[] nalu : nalus) {
|
||||
processSingleNalu(session, nalu, frameInfo, currentTime);
|
||||
}
|
||||
}
|
||||
|
||||
session.frameCount++;
|
||||
|
||||
// 每100帧打印一次日志
|
||||
if (session.frameCount % 100 == 0) {
|
||||
log.info("视频流帧统计 - StreamID: {}, Frames: {}, HasKeyFrame: {}",
|
||||
session.streamId, session.frameCount, session.hasKeyFrame);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("处理原始帧异常 - ConnectID: {}, Error: {}", connectId, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleDecYuvNotify(int connectId, Pointer data, int len, NVSSDK1.FRAME_INFO frameInfo) {
|
||||
try {
|
||||
if (len > 0) {
|
||||
StreamSession session = connectIdSessions.get(connectId);
|
||||
if (session != null && session.frameCallback != null) {
|
||||
byte[] frameData = data.getByteArray(0, len);
|
||||
session.frameCallback.onFrame(frameData, frameInfo.nType);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("解码帧通知处理异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setFrameCallback(String streamId, FrameCallback callback) {
|
||||
try {
|
||||
StreamSession session = activeSessions.get(streamId);
|
||||
if (session != null) {
|
||||
session.frameCallback = callback;
|
||||
log.info("设置帧回调成功, StreamID: {}, ConnectID: {}", streamId, session.connectId);
|
||||
return true;
|
||||
} else {
|
||||
log.warn("设置帧回调失败, 未找到会话: {}", streamId);
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("设置帧回调异常: {}", e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean stopStream(String streamId) {
|
||||
try {
|
||||
StreamSession session = activeSessions.remove(streamId);
|
||||
if (session != null) {
|
||||
logonSessions.remove(session.logonId);
|
||||
connectIdSessions.remove(session.connectId);
|
||||
|
||||
// 停止播放
|
||||
NetClient1.StopPlay(session.connectId);
|
||||
// 停止数据捕获
|
||||
NetClient1.StopCaptureData(session.connectId);
|
||||
// 停止接收
|
||||
int iRet = NetClient1.StopRecv(session.connectId);
|
||||
|
||||
log.info("视频流停止成功, StreamID: {}, ConnectID: {}, 停止结果: {}",
|
||||
streamId, session.connectId, iRet);
|
||||
return true;
|
||||
}
|
||||
log.warn("停止视频流失败, 未找到会话: {}", streamId);
|
||||
return false;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("停止视频流异常: {}", e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean logout(int logonId) {
|
||||
try {
|
||||
StreamSession session = logonSessions.get(logonId);
|
||||
if (session != null) {
|
||||
stopStream(session.streamId);
|
||||
}
|
||||
|
||||
int iRet = NetClient1.Logoff(logonId);
|
||||
boolean success = (iRet == NVSSDK1.RET_SUCCESS);
|
||||
|
||||
if (success) {
|
||||
log.info("登出成功, LogonID: {}", logonId);
|
||||
} else {
|
||||
log.warn("登出失败, LogonID: {}, 错误码: {}", logonId, iRet);
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("登出异常: {}", e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean cleanup() {
|
||||
try {
|
||||
// 停止所有活跃会话
|
||||
for (String streamId : activeSessions.keySet().toArray(new String[0])) {
|
||||
stopStream(streamId);
|
||||
}
|
||||
activeSessions.clear();
|
||||
logonSessions.clear();
|
||||
connectIdSessions.clear();
|
||||
|
||||
// 清理SDK
|
||||
int iRet = NetClient1.Cleanup();
|
||||
boolean success = (iRet == NVSSDK1.RET_SUCCESS);
|
||||
|
||||
if (success) {
|
||||
sdkInitialized = false;
|
||||
log.info("SDK清理成功");
|
||||
} else {
|
||||
log.warn("SDK清理失败, 错误码: {}", iRet);
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("SDK清理异常: {}", e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private String generateStreamId() {
|
||||
return "stream_" + System.currentTimeMillis() + "_" + Math.abs((int)(Math.random() * 10000));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会话状态(用于调试)
|
||||
*/
|
||||
public Map<String, Object> getSessionStatus(String streamId) {
|
||||
StreamSession session = activeSessions.get(streamId);
|
||||
if (session != null) {
|
||||
Map<String, Object> status = new java.util.HashMap<>();
|
||||
status.put("streamId", session.streamId);
|
||||
status.put("logonId", session.logonId);
|
||||
status.put("connectId", session.connectId);
|
||||
status.put("hasCallback", session.frameCallback != null);
|
||||
status.put("activeSessions", activeSessions.size());
|
||||
status.put("connectSessions", connectIdSessions.size());
|
||||
status.put("logonSessions", logonSessions.size());
|
||||
return status;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查会话是否存在
|
||||
*/
|
||||
public boolean isSessionActive(String streamId) {
|
||||
return activeSessions.containsKey(streamId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理单个NALU并封装为FLV
|
||||
*/
|
||||
private void processSingleNalu(StreamSession session, byte[] nalu,
|
||||
NVSSDK1.RAWFRAME_INFO frameInfo, long timestamp) {
|
||||
if (nalu.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int naluType = FLVEncoder.H264NaluParser.getNaluType(nalu);
|
||||
boolean isKeyFrame = false;
|
||||
|
||||
switch (naluType) {
|
||||
case FLVEncoder.H264NaluParser.NALU_TYPE_SPS:
|
||||
session.sps = nalu.clone();
|
||||
log.info("收到SPS - StreamID: {}, Length: {}", session.streamId, nalu.length);
|
||||
break;
|
||||
|
||||
case FLVEncoder.H264NaluParser.NALU_TYPE_PPS:
|
||||
session.pps = nalu.clone();
|
||||
log.info("收到PPS - StreamID: {}, Length: {}", session.streamId, nalu.length);
|
||||
break;
|
||||
|
||||
case FLVEncoder.H264NaluParser.NALU_TYPE_IDR:
|
||||
isKeyFrame = true;
|
||||
session.hasKeyFrame = true;
|
||||
// 继续执行下面的处理
|
||||
case FLVEncoder.H264NaluParser.NALU_TYPE_SLICE:
|
||||
// 发送FLV视频Tag
|
||||
sendFlvVideoTag(session, nalu, isKeyFrame, timestamp);
|
||||
break;
|
||||
|
||||
default:
|
||||
// 忽略其他类型的NALU
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送FLV视频Tag
|
||||
*/
|
||||
private void sendFlvVideoTag(StreamSession session, byte[] nalu,
|
||||
boolean isKeyFrame, long timestamp) {
|
||||
try {
|
||||
// 确保SPS/PPS已获取
|
||||
if (isKeyFrame && session.sps != null && session.pps != null) {
|
||||
// 发送FLV头(如果是第一帧关键帧)
|
||||
if (!session.flvHeaderSent) {
|
||||
sendFlvHeader(session);
|
||||
sendFlvMetadata(session);
|
||||
session.flvHeaderSent = true;
|
||||
}
|
||||
|
||||
// 发送包含AVC配置的视频Tag
|
||||
byte[] videoTag = FLVEncoder.createAVCVideoTag(nalu, true, timestamp,
|
||||
session.sps, session.pps);
|
||||
byte[] prevTagSize = FLVEncoder.createPreviousTagSize(videoTag.length);
|
||||
|
||||
// 发送数据
|
||||
if (session.frameCallback != null) {
|
||||
session.frameCallback.onFrame(prevTagSize, 0);
|
||||
session.frameCallback.onFrame(videoTag, 0);
|
||||
}
|
||||
|
||||
} else if (!isKeyFrame && session.hasKeyFrame) {
|
||||
// 发送普通视频帧
|
||||
byte[] videoTag = FLVEncoder.createAVCVideoTag(nalu, false, timestamp,
|
||||
null, null);
|
||||
byte[] prevTagSize = FLVEncoder.createPreviousTagSize(videoTag.length);
|
||||
|
||||
if (session.frameCallback != null) {
|
||||
session.frameCallback.onFrame(prevTagSize, 0);
|
||||
session.frameCallback.onFrame(videoTag, 0);
|
||||
}
|
||||
|
||||
// 每隔一定帧数发送一个空音频Tag(保持流活跃)
|
||||
if (session.frameCount % 30 == 0) {
|
||||
byte[] audioTag = FLVEncoder.createSilentAudioTag(timestamp);
|
||||
byte[] audioPrevSize = FLVEncoder.createPreviousTagSize(audioTag.length);
|
||||
|
||||
if (session.frameCallback != null) {
|
||||
session.frameCallback.onFrame(audioPrevSize, 0);
|
||||
session.frameCallback.onFrame(audioTag, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("发送FLV视频Tag异常 - StreamID: {}, Error: {}",
|
||||
session.streamId, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送FLV Header
|
||||
*/
|
||||
private void sendFlvHeader(StreamSession session) {
|
||||
try {
|
||||
byte[] flvHeader = FLVEncoder.createFlvHeader();
|
||||
if (session.frameCallback != null) {
|
||||
session.frameCallback.onFrame(flvHeader, 0);
|
||||
log.info("FLV Header已发送 - StreamID: {}", session.streamId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("发送FLV Header异常: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送FLV Metadata
|
||||
*/
|
||||
private void sendFlvMetadata(StreamSession session) {
|
||||
try {
|
||||
// 默认分辨率640x480,25fps
|
||||
byte[] metadata = FLVEncoder.createMetadata(640, 480, 25.0);
|
||||
byte[] prevTagSize = FLVEncoder.createPreviousTagSize(metadata.length);
|
||||
|
||||
if (session.frameCallback != null) {
|
||||
session.frameCallback.onFrame(prevTagSize, 0);
|
||||
session.frameCallback.onFrame(metadata, 0);
|
||||
log.info("FLV Metadata已发送 - StreamID: {}", session.streamId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("发送FLV Metadata异常: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,248 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.whdc.video.NVSSDK1;
|
||||
import com.whdc.video.NetClient1;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class VideoPlayService1 {
|
||||
|
||||
private boolean sdkInitialized = false;
|
||||
private Map<String, StreamSession> activeSessions = new ConcurrentHashMap<>();
|
||||
private Map<Integer, StreamSession> logonSessions = new ConcurrentHashMap<>();
|
||||
|
||||
public static interface FrameCallback {
|
||||
void onFrame(byte[] frameData);
|
||||
}
|
||||
|
||||
private static class StreamSession {
|
||||
String streamId;
|
||||
int logonId;
|
||||
int connectId;
|
||||
FrameCallback frameCallback;
|
||||
|
||||
StreamSession(String streamId) {
|
||||
this.streamId = streamId;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean initSDK() {
|
||||
try {
|
||||
if (sdkInitialized) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 获取SDK版本
|
||||
NVSSDK1.SDK_VERSION ver = new NVSSDK1.SDK_VERSION();
|
||||
int iRet = NetClient1.GetVersion(ver);
|
||||
log.info("[SDK_VERSION] {}", ver.m_cVerInfo);
|
||||
|
||||
// 设置通知回调
|
||||
iRet = NetClient1.SetNotifyFunction(null, null, null);
|
||||
log.info("SetNotifyFunction({})", iRet);
|
||||
|
||||
// 启动SDK
|
||||
iRet = NetClient1.Startup();
|
||||
log.info("Startup({})", iRet);
|
||||
|
||||
sdkInitialized = (iRet == NVSSDK1.RET_SUCCESS);
|
||||
return sdkInitialized;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("SDK初始化异常: {}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int login(String ip, int port, String username, String password) {
|
||||
try {
|
||||
if (!sdkInitialized) {
|
||||
throw new IllegalStateException("SDK未初始化");
|
||||
}
|
||||
|
||||
NVSSDK1.LogonPara logonPara = new NVSSDK1.LogonPara();
|
||||
logonPara.iSize = logonPara.size();
|
||||
logonPara.cNvsIP = ip.getBytes();
|
||||
logonPara.iNvsPort = port;
|
||||
logonPara.cUserName = username.getBytes();
|
||||
logonPara.cUserPwd = password.getBytes();
|
||||
logonPara.write();
|
||||
|
||||
int logonId = NetClient1.Logon_V4(NVSSDK1.SERVER_NORMAL, logonPara.getPointer(), logonPara.size());
|
||||
|
||||
if (logonId < 0) {
|
||||
throw new RuntimeException("登录失败, 错误码: " + logonId);
|
||||
}
|
||||
|
||||
log.info("登录成功, LogonID: {}", logonId);
|
||||
return logonId;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("登录异常: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public String startStream(int logonId, int channelNo, int streamType, int netMode) {
|
||||
try {
|
||||
// 创建流会话
|
||||
String streamId = generateStreamId();
|
||||
StreamSession session = new StreamSession(streamId);
|
||||
session.logonId = logonId;
|
||||
|
||||
// 启动视频流接收
|
||||
NVSSDK1.CLIENTINFO clientInfo = new NVSSDK1.CLIENTINFO();
|
||||
clientInfo.m_iChannelNo = channelNo;
|
||||
clientInfo.m_iNetMode = netMode;
|
||||
clientInfo.m_iStreamNO = streamType;
|
||||
clientInfo.m_iServerID = logonId;
|
||||
clientInfo.m_iBufferCount = 20;
|
||||
clientInfo.write();
|
||||
|
||||
IntByReference piConnectID = new IntByReference();
|
||||
|
||||
// 设置数据回调
|
||||
NVSSDK1.NVSDATA_NOTIFY dataCallback = new NVSSDK1.NVSDATA_NOTIFY() {
|
||||
public void NvsDataNotify(int _uiID, Pointer _pucData, int _iLen, Pointer _iUser) {
|
||||
// 处理原始数据
|
||||
byte[] frameData = _pucData.getByteArray(0, _iLen);
|
||||
if (session.frameCallback != null) {
|
||||
session.frameCallback.onFrame(frameData);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int iRet = NetClient1.StartRecv_V4(piConnectID, clientInfo, dataCallback, null);
|
||||
if (iRet < 0) {
|
||||
throw new RuntimeException("启动视频流接收失败, 错误码: " + iRet);
|
||||
}
|
||||
|
||||
int connectId = piConnectID.getValue();
|
||||
session.connectId = connectId;
|
||||
|
||||
// 开始捕获数据
|
||||
NetClient1.StartCaptureData(connectId);
|
||||
|
||||
// 设置原始帧回调
|
||||
NVSSDK1.RAWFRAME_NOTIFY rawFrameCallback = new NVSSDK1.RAWFRAME_NOTIFY() {
|
||||
public void rawFrameNotify(int _uiID, Pointer _pcData, int _iLen,
|
||||
NVSSDK1.RAWFRAME_INFO _ptRawFrameInfo, Pointer _pvUsrData) {
|
||||
// 只处理视频帧
|
||||
if (_ptRawFrameInfo.nType == NVSSDK1.VI_FRAME ||
|
||||
_ptRawFrameInfo.nType == NVSSDK1.VP_FRAME) {
|
||||
byte[] frameData = _pcData.getByteArray(0, _iLen);
|
||||
if (session.frameCallback != null) {
|
||||
session.frameCallback.onFrame(frameData);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NetClient1.SetRawFrameCallBack(connectId, rawFrameCallback, null);
|
||||
NetClient1.StartPlay(connectId, null, 0);
|
||||
|
||||
// 保存会话
|
||||
activeSessions.put(streamId, session);
|
||||
logonSessions.put(logonId, session);
|
||||
|
||||
log.info("视频流启动成功, StreamID: {}, ConnectID: {}", streamId, connectId);
|
||||
return streamId;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("启动视频流异常: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public void setFrameCallback(String streamId, FrameCallback callback) {
|
||||
StreamSession session = activeSessions.get(streamId);
|
||||
if (session != null) {
|
||||
session.frameCallback = callback;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean stopStream(String streamId) {
|
||||
try {
|
||||
StreamSession session = activeSessions.remove(streamId);
|
||||
if (session != null) {
|
||||
logonSessions.remove(session.logonId);
|
||||
|
||||
// 停止播放
|
||||
NetClient1.StopPlay(session.connectId);
|
||||
// 停止数据捕获
|
||||
NetClient1.StopCaptureData(session.connectId);
|
||||
// 停止接收
|
||||
NetClient1.StopRecv(session.connectId);
|
||||
|
||||
System.out.println("视频流停止成功, StreamID: " + streamId);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("停止视频流异常: " + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean logout(int logonId) {
|
||||
try {
|
||||
StreamSession session = logonSessions.get(logonId);
|
||||
if (session != null) {
|
||||
stopStream(session.streamId);
|
||||
}
|
||||
|
||||
int iRet = NetClient1.Logoff(logonId);
|
||||
boolean success = (iRet == NVSSDK1.RET_SUCCESS);
|
||||
|
||||
if (success) {
|
||||
System.out.println("登出成功, LogonID: " + logonId);
|
||||
} else {
|
||||
System.err.println("登出失败, LogonID: " + logonId + ", 错误码: " + iRet);
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("登出异常: " + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean cleanup() {
|
||||
try {
|
||||
// 停止所有活跃会话
|
||||
for (String streamId : activeSessions.keySet()) {
|
||||
stopStream(streamId);
|
||||
}
|
||||
activeSessions.clear();
|
||||
logonSessions.clear();
|
||||
|
||||
// 清理SDK
|
||||
int iRet = NetClient1.Cleanup();
|
||||
boolean success = (iRet == NVSSDK1.RET_SUCCESS);
|
||||
|
||||
if (success) {
|
||||
sdkInitialized = false;
|
||||
log.info("SDK清理成功");
|
||||
} else {
|
||||
log.error("SDK清理失败, 错误码: " + iRet);
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("SDK清理异常: {}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private String generateStreamId() {
|
||||
return "stream_" + System.currentTimeMillis() + "_" + Math.abs((int)(Math.random() * 10000));
|
||||
}
|
||||
}
|
||||
|
|
@ -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,197 @@
|
|||
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 Integer 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;
|
||||
}
|
||||
|
||||
@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 m_iServerID,int channelNo, int direction, int speed) {
|
||||
int iRet;
|
||||
if (direction == NVSSDK1.PROTOCOL_MOVE_UP || direction == NVSSDK1.PROTOCOL_MOVE_DOWN) {
|
||||
iRet = NetClient1.DeviceCtrlEx(m_iServerID, channelNo, direction, 0, speed, 0);
|
||||
} else if (direction == NVSSDK1.PROTOCOL_MOVE_LEFT || direction == NVSSDK1.PROTOCOL_MOVE_RIGHT) {
|
||||
iRet = NetClient1.DeviceCtrlEx(m_iServerID, channelNo, direction, speed, 0, 0);
|
||||
} else {
|
||||
iRet = NetClient1.DeviceCtrlEx(m_iServerID, 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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.whdc.entity.WqRReal;
|
||||
import com.whdc.mapper.WqRealMapper;
|
||||
import com.whdc.service.WqRRealService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 水质信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wanyan
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
@Service
|
||||
public class WqRRealServiceImp extends ServiceImpl<WqRealMapper, WqRReal> implements WqRRealService {
|
||||
|
||||
@Value("${offlineThreshold}")
|
||||
private Integer offlineThreshold;
|
||||
|
||||
@Override
|
||||
public List<WqRReal> getList() {
|
||||
LambdaQueryWrapper<WqRReal> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.orderByDesc(WqRReal::getTm).orderByAsc(WqRReal::getMn);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Boolean, List<WqRReal>> online() {
|
||||
List<WqRReal> list = this.list();
|
||||
if(list != null && !list.isEmpty()) {
|
||||
return list.stream()
|
||||
.collect(Collectors.partitioningBy(device -> !isDeviceOffline(device),
|
||||
// 对分组后的列表按时间倒序排序
|
||||
Collectors.collectingAndThen(
|
||||
Collectors.toList(),
|
||||
des -> des.stream()
|
||||
.sorted(Comparator.comparing(WqRReal::getTm).reversed())
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
));
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
public boolean isDeviceOffline(WqRReal device) {
|
||||
return isDeviceOffline(device, offlineThreshold*3600*1000);
|
||||
}
|
||||
|
||||
public boolean isDeviceOffline(WqRReal device, long threshold) {
|
||||
return isDeviceOffline(device, LocalDateTime.now(), threshold);
|
||||
}
|
||||
|
||||
private boolean isDeviceOffline(WqRReal device, LocalDateTime currentTime, long threshold) {
|
||||
if (device == null || device.getTm() == null) {
|
||||
return true; // 没有时间数据的设备视为离线
|
||||
}
|
||||
|
||||
Duration duration = Duration.between(device.getTm(), currentTime);
|
||||
long millis = duration.toMillis();
|
||||
|
||||
return millis >= threshold;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
package com.whdc.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.whdc.entity.QueryDto;
|
||||
import com.whdc.entity.WqR;
|
||||
import com.whdc.mapper.WqRMapper;
|
||||
import com.whdc.service.WqRService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 水质信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author wanyan
|
||||
* @since 2023-11-01
|
||||
*/
|
||||
@Service
|
||||
public class WqRServiceImp extends ServiceImpl<WqRMapper, WqR> implements WqRService {
|
||||
|
||||
@Override
|
||||
public List<WqR> getList(QueryDto queryDto) {
|
||||
LambdaQueryWrapper<WqR> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(WqR::getMn, queryDto.getMn());
|
||||
if(queryDto.getStartTime() != null){
|
||||
queryWrapper.gt(WqR::getTm, queryDto.getStartTime());
|
||||
}
|
||||
if(queryDto.getEndTime() != null){
|
||||
queryWrapper.lt(WqR::getTm, queryDto.getEndTime());
|
||||
}
|
||||
queryWrapper.orderByDesc(WqR::getTm);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,514 @@
|
|||
package com.whdc.syncjava;
|
||||
|
||||
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 NVSSDK3 extends Library {
|
||||
|
||||
//Synchronous blocking interface return value
|
||||
public static final int RET_SUCCESS = 0; //success
|
||||
public static final int RET_FAILED = -1; //fail
|
||||
public static final int RET_SYNCLOGON_TIMEOUT = -300; //Synchronous login times out, the network is normal, but the peer does not respond
|
||||
public static final int RET_SYNCLOGON_USENAME_ERROR = -301; //Synchronous login failed, username does not exist, default username: admin
|
||||
public static final int RET_SYNCLOGON_USRPWD_ERROR = -302; //Synchronous login failed, the password is wrong, the default password: 1111, if the user has changed the password, please enter the correct password.
|
||||
public static final int RET_SYNCLOGON_PWDERRTIMES_OVERRUN = -303; //Synchronous login failed, the number of incorrect passwords exceeded the limit, and the account was locked
|
||||
public static final int RET_SYNCLOGON_NET_ERROR = -304; //Synchronous login failed, network connection error
|
||||
public static final int RET_SYNCLOGON_PORT_ERROR = -305; //Synchronous login failed, the communication port input is incorrect, the default incoming port is 3000
|
||||
public static final int RET_SYNCLOGON_UNKNOW_ERROR = -306; //Synchronous login failed with unknown error
|
||||
public static final int RET_SYNCREALPLAY_TIMEOUT = -307; //The synchronous connection video timed out, and the peer did not send the video header protocol
|
||||
public static final int RET_SYNCREALPLAY_FAIL = -308; //Failed to play video when sync connected video
|
||||
public static final int RET_SYNCSUSPENDVCA_CONFIGING = -309; //Synchronous pause intelligent analysis failed, intelligent analysis parameters are being set by other clients
|
||||
public static final int RET_SYNCSUSPENDVCA_FAIL = -310; //Synchronization pause intelligent analysis failed, the device did not return the code
|
||||
public static final int RET_SYNCOPENVCA_CONFIGING = -311; //Failed to enable intelligent analysis synchronously, intelligent analysis parameters are being set by other clients
|
||||
public static final int RET_SYNCOPENVCA_FAIL = -312; //Failed to enable intelligent analysis synchronously, the device did not return the code
|
||||
public static final int RET_SYNCOPTVCA_TIMEOUE = -313; //Sync Pause/On Smart Analysis Timeout
|
||||
|
||||
public static final int SYNC_NET_CLIENT_VCA_SUSPEND = 0;
|
||||
|
||||
public static final int SERVER_NORMAL = 0;
|
||||
public static final int SERVER_ACTIVE = 1;
|
||||
|
||||
public static final int DSM_CMD_SET_NET_WAN_INFO = 0; //[ActiveNetWanInfo]local public network ip and port
|
||||
public static final int DSM_CMD_SET_DIRECTORY_INFO = 1; //[ActiveDirectoryInfo]directory public network ip, port,account,password....
|
||||
public static final int DSM_CMD_SET_NVSREG_CALLBACK = 2;
|
||||
|
||||
public static final int DSM_CMD_GET_ONLINE_STATE = 0;
|
||||
public static final int WCM_DWONLOAD_FINISHED = 19;
|
||||
public static final int WCM_DWONLOAD_FAULT = 20;
|
||||
public static final int WCM_DOWNLOAD_INTERRUPT = 29;
|
||||
|
||||
|
||||
//Front end video query
|
||||
public static final int CMD_NETFILE_QUERY_FILE = 0;
|
||||
public static final int CMD_NETFILE_QUERY_LOG = 8;
|
||||
|
||||
public static final int DOWNLOAD_CMD_FILE = 0;
|
||||
public static final int DOWNLOAD_CMD_TIMESPAN = 1;
|
||||
public static final int DOWNLOAD_CMD_CONTROL = 2;
|
||||
|
||||
//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 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
|
||||
public int[] iQueryTypeValue = new int[6];
|
||||
public int iCurQueryCount; //output para, synchronized blocking interface use, return current query count
|
||||
public int iTotalQueryCount; //output para, synchronized blocking interface use, return total query count
|
||||
}
|
||||
|
||||
//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 QueryFileResult extends Structure {
|
||||
public NVS_FILE_DATA[] tArry = new NVS_FILE_DATA[20];
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
//Network to receive the original data, not a complete data frame can be used for proxy forwarding
|
||||
public static interface NVSDATA_NOTIFY extends Callback {
|
||||
void nvsDataNotify(int _iID, Pointer _pcData, int _iLen, Pointer _pvUser);
|
||||
}
|
||||
|
||||
//Complete a frame of data, can be used to write video files, or send player to play. You want to distinguish the type of _ulStreamType
|
||||
public static interface FULLFRAME_NOTIFY_V4 extends StdCallCallback {
|
||||
void fullFrameNotifyV4(int _iID, int _iStreamType, Pointer _pcData, int _iLen, Pointer _pvHeader, Pointer _pvUserData);
|
||||
}
|
||||
|
||||
public static class NetClientPara extends Structure {
|
||||
public int iSize;
|
||||
public CLIENTINFO tCltInfo;
|
||||
public int iCryptType; //iCryptType = 0, no encryption; iCryptType = 1, is AES encryption
|
||||
public byte[] cCryptKey = new byte[32];
|
||||
public NVSDATA_NOTIFY cbkDataArrive; //Network to receive the original data,
|
||||
public Pointer pvUserData;
|
||||
public int iPicType; //Client request picture stream type.Structured proprietary(This field is not sent or sent 0: indicates that the server is adaptively sent and sent based on the current configuration.)
|
||||
//bit0: Face picture stream
|
||||
//bit1: Traffic picture stream
|
||||
public FULLFRAME_NOTIFY_V4 pCbkFullFrm; //full frame callback, it's private frame
|
||||
public Pointer pvCbkFullFrmUsrData;
|
||||
public RAWFRAME_NOTIFY pCbkRawFrm; //raw frame callback
|
||||
public Pointer pvCbkRawFrmUsrData;
|
||||
public int iIsForbidDecode; //Synchronized blocking interface extension para: 0----allow decode, 1----forbid decode
|
||||
public Pointer pvWnd; //Synchronized blocking interface extension para: the window handle of show video, if NULL can not show video
|
||||
};
|
||||
|
||||
public static class NVS_LOG_QUERY extends Structure {
|
||||
public int iChannelNo; //channel number
|
||||
public int iLogType; //Log type: 0, syslog, 1, warning, 2, alarm, 3, action, 4, user, 5, other, 0xFF, all types
|
||||
public int iLanguage; //language type: 0, English; 1, GB2312 simplified; 2, BIG5 traditional ; 3, Korean; 4, Spain; 5, Italian,
|
||||
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 static class NVS_LOG_DATA extends Structure {
|
||||
public int iChannel;
|
||||
public int iLogType;
|
||||
public NVS_FILE_TIME tStartTime; /* File start time */
|
||||
public NVS_FILE_TIME tStopTime; /* File end time */
|
||||
public byte[] szLogContent = new byte[129];
|
||||
};
|
||||
|
||||
public static class QueryLogResult extends Structure {
|
||||
public NVS_LOG_DATA[] tArry = new NVS_LOG_DATA[20];
|
||||
}
|
||||
|
||||
public static final int VCA_OPT_SUSPEND = 0;
|
||||
public static final int VCA_OPT_OPENVCA = 1;
|
||||
public static final int VCA_OPT_RESULT_SUCCESS = 1;
|
||||
public static final int VCA_OPT_RESULT_CONFIGING = 2;
|
||||
|
||||
public static class VCASuspend extends Structure {
|
||||
public int iStatus; //Status(0:Suspend intelligent analysis 1:Open intelligent analysis)
|
||||
public int iDevType; //0-IPC, 1-NVR
|
||||
};
|
||||
|
||||
public static class VCASuspendResult extends Structure {
|
||||
public int iBufSize; //structure size
|
||||
public int iStatus; //Status(0:Suspend intelligent analysis 1:Open intelligent analysis)
|
||||
public int iResult; //Result(1:success[indicate that parameters can be set] 2:fail[indicate that parameter is being set and can not set])
|
||||
public int iDevType; //0-IPC, 1-NVR
|
||||
};
|
||||
|
||||
public static class ActiveNetWanInfo extends Structure {
|
||||
public int iSize;
|
||||
public byte[] cWanIP = new byte[32]; //Local public network ip
|
||||
public int iWanPort; //Local public network port
|
||||
};
|
||||
|
||||
public static final int DSM_STATE_OFFLINE = 0;
|
||||
public static final int DSM_STATE_ONLINE = 1;
|
||||
public static class DsmOnline extends Structure {
|
||||
public int iSize;
|
||||
public byte[] cProductID = new byte[32]; //product id
|
||||
public int iOnline; //0--Offline 1--Online
|
||||
public byte[] cWanIP = new byte[32];
|
||||
public byte[] cLanIP = new byte[32];
|
||||
};
|
||||
|
||||
public static class LogonActiveServer extends Structure {
|
||||
public int iSize;
|
||||
public byte[] cUserName = new byte[16];
|
||||
public byte[] cUserPwd = new byte[16];
|
||||
public byte[] cProductID = new byte[32]; //product id
|
||||
};
|
||||
|
||||
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]; //IPV4 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 byte[] cNvsIPV6 = new byte[64]; //IPV6 address
|
||||
};
|
||||
|
||||
public static class LocalSDKPath extends Structure {
|
||||
public int iSize;
|
||||
public int iType;
|
||||
public byte[] cPath = new byte[256];
|
||||
};
|
||||
|
||||
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_SetDsmConfig(int _iCommand, Pointer _pvBuf, int _iBufSize);
|
||||
int NetClient_GetDsmRegstierInfo(int _iCommand, Pointer _pvBuf, int _iBufSize);
|
||||
int NetClient_Logon(String _cProxy, String _cIP, String _cUserName, String _cPassword, String _pcProID, int _iPort);
|
||||
int NetClient_SyncLogon(int _iLogonType, Pointer _pvPara, int _iParaSize);
|
||||
int NetClient_Logoff(int _iLogonID);
|
||||
int NetClient_GetChannelNum(int _iLogonID, IntByReference _piChanNum);
|
||||
int NetClient_GetDigitalChannelNum(int _iLogonID, IntByReference _piDigitChannelNum);
|
||||
int NetClient_StartRecvEx(IntByReference _ulConID, CLIENTINFO _cltInfo, RECVDATA_NOTIFY _cbkDataNotify, Pointer _pUserData);
|
||||
int NetClient_SyncRealPlay(IntByReference _puiRecvID, NetClientPara _ptPara, int _iParaSize);
|
||||
int NetClient_StopRealPlay(int _uiRecvID, int _iParam);
|
||||
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);
|
||||
int NetClient_SyncQuery(int _iLogonID, int _iChanNo, int _iCmd, Pointer _pvInPara, int _iInLen, Pointer _pvOutPara, int _iOutTotalLen, int _iSingleLen);
|
||||
int NetClient_NetLogGetLogCount(int _iLogonID, IntByReference _iTotalCount, IntByReference _iCurrentCount);
|
||||
int NetClient_SyncSetDevCfg(int _iLogonID, int _iChanNo, int _iCmd, Pointer _pvInPara, int _iInLen, Pointer _pvOutRet, int _iOutLen);
|
||||
int NetClient_SetSDKInitConfig(int _iCmd, Pointer _lpInBuffer, int _iInLen);
|
||||
}
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
package com.whdc.syncjava;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
public class NetClient3 {
|
||||
|
||||
private static NVSSDK3 nvssdk = (NVSSDK3)(System.getProperty("os.name").toLowerCase().startsWith("win")?Native.loadLibrary("NVSSDK.dll", NVSSDK3.class):Native.loadLibrary("libnvssdk.so", NVSSDK3.class));
|
||||
// private static NVSSDK3 nvssdk = NativeLibraryLoader.loadLibraryFromLib(
|
||||
// NVSSDK3.class, "NVSSDK.dll", "libnvssdk.so"
|
||||
// );
|
||||
public static int GetVersion(NVSSDK3.SDK_VERSION _ver) {
|
||||
return nvssdk.NetClient_GetVersion(_ver);
|
||||
}
|
||||
|
||||
public static int SetNotifyFunction(NVSSDK3.MAIN_NOTIFY _cbkMainNotify,
|
||||
NVSSDK3.ALARM_NOTIFY _cbkAlarmNotify, NVSSDK3.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 SetDsmConfig(int _iCommand, Pointer _pvBuf, int _iBufSize) {
|
||||
return nvssdk.NetClient_SetDsmConfig(_iCommand, _pvBuf, _iBufSize);
|
||||
}
|
||||
|
||||
public static int GetDsmRegstierInfo(int _iCommand, Pointer _pvBuf, int _iBufSize) {
|
||||
return nvssdk.NetClient_GetDsmRegstierInfo(_iCommand, _pvBuf, _iBufSize);
|
||||
}
|
||||
|
||||
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 SyncLogon(int _iLogonType, Pointer _pvPara, int _iParaSize) {
|
||||
return nvssdk.NetClient_SyncLogon(_iLogonType, _pvPara, _iParaSize);
|
||||
}
|
||||
|
||||
public static int Logoff(int _iLogonID) {
|
||||
return nvssdk.NetClient_Logoff(_iLogonID);
|
||||
}
|
||||
|
||||
public static int GetChannelNum(int _iLogonID, IntByReference _piChanNum) {
|
||||
return nvssdk.NetClient_GetChannelNum(_iLogonID, _piChanNum);
|
||||
}
|
||||
|
||||
public static int GetDigitalChannelNum(int _iLogonID, IntByReference _piDigitChannelNum) {
|
||||
return nvssdk.NetClient_GetDigitalChannelNum(_iLogonID, _piDigitChannelNum);
|
||||
}
|
||||
|
||||
public static int StartRecv(IntByReference _ulConID, NVSSDK3.CLIENTINFO _cltInfo,
|
||||
NVSSDK3.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 SyncRealPlay(IntByReference _puiRecvID, NVSSDK3.NetClientPara _ptPara, int _iParaSize) {
|
||||
return nvssdk.NetClient_SyncRealPlay(_puiRecvID, _ptPara, _iParaSize);
|
||||
}
|
||||
|
||||
public static int StopRealPlay(int _uiRecvID, int _iParam) {
|
||||
return nvssdk.NetClient_StopRealPlay(_uiRecvID, _iParam);
|
||||
}
|
||||
|
||||
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);
|
||||
NVSSDK3.RECT rcShow = new NVSSDK3.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, NVSSDK3.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 , NVSSDK3.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, NVSSDK3.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, NVSSDK3.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);
|
||||
}
|
||||
|
||||
public static int SyncQuery(int _iLogonID, int _iChanNo, int _iCmd, Pointer _pvInPara, int _iInLen, Pointer _pvOutPara, int _iOutTotalLen, int _iSingleLen) {
|
||||
return nvssdk.NetClient_SyncQuery(_iLogonID, _iChanNo, _iCmd, _pvInPara, _iInLen, _pvOutPara, _iOutTotalLen, _iSingleLen);
|
||||
}
|
||||
|
||||
public static int NetLogGetLogCount(int _iLogonID, IntByReference _iTotalCount, IntByReference _iCurrentCount) {
|
||||
return nvssdk.NetClient_NetLogGetLogCount(_iLogonID, _iTotalCount, _iCurrentCount);
|
||||
}
|
||||
|
||||
public static int SyncSetDevCfg(int _iLogonID, int _iChanNo, int _iCmd, Pointer _pvInPara, int _iInLen, Pointer _pvOutRet, int _iOutLen) {
|
||||
return nvssdk.NetClient_SyncSetDevCfg(_iLogonID, _iChanNo, _iCmd, _pvInPara, _iInLen, _pvOutRet, _iOutLen);
|
||||
}
|
||||
|
||||
public static int SetSDKInitConfig(int _iCmd, Pointer _lpInBuffer, int _iInLen){
|
||||
return nvssdk.NetClient_SetSDKInitConfig(_iCmd, _lpInBuffer, _iInLen);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,926 @@
|
|||
package com.whdc.syncjava;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
|
||||
public class SyncBusiness {
|
||||
// Demonstrate the SDK calling example, take a device as an example
|
||||
static int m_iLogonID = -1;
|
||||
// Demonstrate the SDK calling example, take connecting one video as an example
|
||||
static int m_iConnectID = -1;
|
||||
//Store the map of demo operation instructions
|
||||
Map<String, Integer> m_mapOptCmd = new HashMap<String, Integer>();
|
||||
|
||||
//Define the demo operation command value
|
||||
public static final int CMD_QUIT = -1;
|
||||
public static final int CMD_SYNCLOGON = 1;
|
||||
public static final int CMD_LOGOFF = 2;
|
||||
public static final int CMD_STARTREALPALY = 3;
|
||||
public static final int CMD_STOPREALPALY = 4;
|
||||
public static final int CMD_SYNCQUERYFILE = 5;
|
||||
public static final int CMD_SYNCQUERYLOG = 6;
|
||||
public static final int CMD_SUSPENDVCA = 7;
|
||||
public static final int CMD_OPENVCA = 8;
|
||||
public static final int CMD_DOWNLOADBYFILE = 9;
|
||||
public static final int CMD_DOWNLOADBYTIME = 10;
|
||||
public static final int CMD_STOPDOWNLOAD = 11;
|
||||
|
||||
public void makeOptCmd()
|
||||
{
|
||||
m_mapOptCmd.put("Quit", CMD_QUIT);
|
||||
m_mapOptCmd.put("q", CMD_QUIT);
|
||||
|
||||
m_mapOptCmd.put("SyncLogon", CMD_SYNCLOGON);
|
||||
m_mapOptCmd.put("1", CMD_SYNCLOGON);
|
||||
|
||||
m_mapOptCmd.put("Logoff", CMD_LOGOFF);
|
||||
m_mapOptCmd.put("2", CMD_LOGOFF);
|
||||
|
||||
m_mapOptCmd.put("StartRealPlay", CMD_STARTREALPALY);
|
||||
m_mapOptCmd.put("3", CMD_STARTREALPALY);
|
||||
|
||||
m_mapOptCmd.put("StopRealPlay", CMD_STOPREALPALY);
|
||||
m_mapOptCmd.put("4", CMD_STOPREALPALY);
|
||||
|
||||
m_mapOptCmd.put("SyncQueryFile", CMD_SYNCQUERYFILE);
|
||||
m_mapOptCmd.put("5", CMD_SYNCQUERYFILE);
|
||||
|
||||
m_mapOptCmd.put("SyncQueryLog", CMD_SYNCQUERYLOG);
|
||||
m_mapOptCmd.put("6", CMD_SYNCQUERYLOG);
|
||||
|
||||
m_mapOptCmd.put("SyncSuspendVca", CMD_SUSPENDVCA);
|
||||
m_mapOptCmd.put("7", CMD_SUSPENDVCA);
|
||||
|
||||
m_mapOptCmd.put("SyncOpenVca", CMD_OPENVCA);
|
||||
m_mapOptCmd.put("8", CMD_OPENVCA);
|
||||
|
||||
m_mapOptCmd.put("DownloadByFile", CMD_DOWNLOADBYFILE);
|
||||
m_mapOptCmd.put("9", CMD_DOWNLOADBYFILE);
|
||||
|
||||
m_mapOptCmd.put("DownloadByTime", CMD_DOWNLOADBYTIME);
|
||||
m_mapOptCmd.put("10", CMD_DOWNLOADBYTIME);
|
||||
|
||||
m_mapOptCmd.put("StopDownload", CMD_STOPDOWNLOAD);
|
||||
m_mapOptCmd.put("11", CMD_STOPDOWNLOAD);
|
||||
}
|
||||
|
||||
public void testSdkApi()
|
||||
{
|
||||
Scanner scanInput = new Scanner(System.in);
|
||||
int iCmd = -1;
|
||||
String strCmd = new String();
|
||||
boolean blQuit = false;
|
||||
while(!blQuit)
|
||||
{
|
||||
System.out.println("***********************************************************");
|
||||
System.out.println(
|
||||
"[q]Quit \n"
|
||||
+ "[1]SyncLogon [2]Logoff \n"
|
||||
+ "[3]StartRealPlay [4]StopRealPlay \n"
|
||||
+ "[5]SyncQueryFile [6]SyncQueryLog \n"
|
||||
+ "[7]SyncSuspendVca [8]SyncOpenVca \n"
|
||||
+ "[9]DownloadByFile [10]DownloadByTime \n"
|
||||
+ "[11]StopDownload");
|
||||
System.out.println("***********************************************************");
|
||||
|
||||
System.out.print("Please input your correct command: ");
|
||||
strCmd = scanInput.next();
|
||||
try {
|
||||
iCmd = m_mapOptCmd.get(strCmd);
|
||||
} catch(Exception e) {
|
||||
iCmd = 0;
|
||||
}
|
||||
switch(iCmd)
|
||||
{
|
||||
case CMD_QUIT: //q
|
||||
{
|
||||
System.out.println("Goodbye, my friend!");
|
||||
blQuit = true;
|
||||
break;
|
||||
}
|
||||
case CMD_SYNCLOGON:
|
||||
{
|
||||
SyncLogon();
|
||||
break;
|
||||
}
|
||||
case CMD_LOGOFF:
|
||||
{
|
||||
Logoff();
|
||||
break;
|
||||
}
|
||||
case CMD_STARTREALPALY:
|
||||
{
|
||||
StartRealPlay();
|
||||
break;
|
||||
}
|
||||
case CMD_STOPREALPALY:
|
||||
{
|
||||
StopRealPlay();
|
||||
break;
|
||||
}
|
||||
case CMD_SYNCQUERYFILE:
|
||||
{
|
||||
SyncQueryFile();
|
||||
break;
|
||||
}
|
||||
case CMD_SYNCQUERYLOG:
|
||||
{
|
||||
SyncQueryLog();
|
||||
break;
|
||||
}
|
||||
case CMD_SUSPENDVCA:
|
||||
{
|
||||
SyncSuspendVca();
|
||||
break;
|
||||
}
|
||||
case CMD_OPENVCA:
|
||||
{
|
||||
SyncOpenVca();
|
||||
break;
|
||||
}
|
||||
case CMD_DOWNLOADBYFILE:
|
||||
{
|
||||
downloadByFileMode();
|
||||
break;
|
||||
}
|
||||
case CMD_DOWNLOADBYTIME:
|
||||
{
|
||||
downloadByTimespanMode();
|
||||
break;
|
||||
}
|
||||
case CMD_STOPDOWNLOAD:
|
||||
{
|
||||
stopDownload();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
System.out.println("Command \"" + strCmd + "\" not found!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int sdkInit() {
|
||||
|
||||
NVSSDK3.SDK_VERSION ver = new NVSSDK3.SDK_VERSION();
|
||||
int iRet = NetClient3.GetVersion(ver);
|
||||
System.out.println("[SDK_VERSION]" + ver.m_cVerInfo);
|
||||
|
||||
iRet = NetClient3.SetNotifyFunction(cbkMain, cbkAlarm, cbkParaChange);
|
||||
System.out.println("SetNotifyFunction(" + iRet + ")");
|
||||
|
||||
iRet = NetClient3.Startup();
|
||||
System.out.println("Startup(" + iRet + ")");
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
private void sdkUnInit() {
|
||||
int iRet = NetClient3.Cleanup();
|
||||
System.out.println("Cleanup(" + iRet + ")");
|
||||
};
|
||||
|
||||
public int SyncLogon()
|
||||
{
|
||||
Scanner scanInput = new Scanner(System.in);
|
||||
int iRet = NVSSDK3.RET_FAILED;
|
||||
|
||||
System.out.print("Please input LogonType(0--Normal 1--Active): ");
|
||||
int iLogonType = scanInput.nextInt();
|
||||
if (NVSSDK3.SERVER_ACTIVE == iLogonType)
|
||||
{
|
||||
//Active mode login logic: The client and the device are not in the same subnet, and need to use the public network to penetrate
|
||||
System.out.print("Please input local listen port:");
|
||||
//Set the local listening internal port
|
||||
int iLocalListenPort = scanInput.nextInt();
|
||||
iRet = NetClient3.SetPort(iLocalListenPort, 0);
|
||||
if(NVSSDK3.RET_SUCCESS != iRet) {
|
||||
System.out.println("NetClient_SetPort fail!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Set the local listening external port (router mapping port)
|
||||
NVSSDK3.ActiveNetWanInfo tLocalWanInfo = new NVSSDK3.ActiveNetWanInfo();
|
||||
tLocalWanInfo.iSize = tLocalWanInfo.size();
|
||||
System.out.print("Please input wan IP: ");
|
||||
String strWanIP = scanInput.next();
|
||||
tLocalWanInfo.cWanIP = strWanIP.getBytes();
|
||||
System.out.print("Please input local wan port:");
|
||||
tLocalWanInfo.iWanPort = scanInput.nextInt();
|
||||
tLocalWanInfo.write();
|
||||
iRet = NetClient3.SetDsmConfig(NVSSDK3.DSM_CMD_SET_NET_WAN_INFO, tLocalWanInfo.getPointer(), tLocalWanInfo.size());
|
||||
if(NVSSDK3.RET_SUCCESS != iRet )
|
||||
{
|
||||
System.out.println("NetClient_SetDsmConfig:DSM_CMD_SET_NET_WAN_INFO fail!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
System.out.print("Please enter the factory ID:");
|
||||
String strProductID = scanInput.next();
|
||||
NVSSDK3.DsmOnline tOnline = new NVSSDK3.DsmOnline();
|
||||
tOnline.iSize = tOnline.size();
|
||||
tOnline.cProductID = strProductID.getBytes();
|
||||
tOnline.write();
|
||||
//Get the registration online status
|
||||
NetClient3.GetDsmRegstierInfo(NVSSDK3.DSM_CMD_GET_ONLINE_STATE, tOnline.getPointer(), tOnline.size());
|
||||
tOnline.read();
|
||||
int iOutTime = 0;
|
||||
while (NVSSDK3.DSM_STATE_ONLINE != tOnline.iOnline)
|
||||
{
|
||||
if (iOutTime >= 30)
|
||||
{
|
||||
System.out.println("Device not register!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.currentThread();
|
||||
Thread.sleep(1000);
|
||||
} catch(InterruptedException e) {
|
||||
System.err.println("Interrupted");
|
||||
}
|
||||
|
||||
NetClient3.GetDsmRegstierInfo(NVSSDK3.DSM_CMD_GET_ONLINE_STATE, tOnline.getPointer(), tOnline.size());
|
||||
tOnline.read();
|
||||
iOutTime++;
|
||||
}
|
||||
|
||||
|
||||
System.out.print("Please input UserName: ");
|
||||
String strUserName = scanInput.next();
|
||||
System.out.print("Please input Password: ");
|
||||
String strUserPwd = scanInput.next();
|
||||
|
||||
NVSSDK3.LogonActiveServer tActive = new NVSSDK3.LogonActiveServer();
|
||||
tActive.iSize = tActive.size();
|
||||
tActive.cUserName = strUserName.getBytes();
|
||||
tActive.cUserPwd = strUserPwd.getBytes();
|
||||
tActive.cProductID = strProductID.getBytes();
|
||||
tActive.write();
|
||||
//Active mode synchronous blocking login device
|
||||
m_iLogonID = NetClient3.SyncLogon(iLogonType, tActive.getPointer(), tActive.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Please enter the device IP:");
|
||||
String strDevIP = scanInput.next();
|
||||
System.out.println("Please enter the device port:");
|
||||
int iDevPort = scanInput.nextInt();
|
||||
System.out.println("Please enter user name:");
|
||||
String strUserName = scanInput.next();
|
||||
System.out.println("Please enter your password:");
|
||||
String strUserPwd = scanInput.next();
|
||||
String strCharSet = "UTF-8";
|
||||
System.out.println("Logon:" + strDevIP + ", " + iDevPort + ", " +strUserName + ", " + strUserPwd);
|
||||
|
||||
NVSSDK3.LogonPara tNormal = new NVSSDK3.LogonPara();
|
||||
tNormal.iSize = tNormal.size();
|
||||
tNormal.cNvsIP = strDevIP.getBytes();
|
||||
tNormal.iNvsPort = iDevPort;
|
||||
tNormal.cUserName = strUserName.getBytes();
|
||||
tNormal.cUserPwd = strUserPwd.getBytes();
|
||||
tNormal.cCharSet = strCharSet.getBytes();
|
||||
tNormal.write();
|
||||
//Regular mode synchronously blocks the login device
|
||||
m_iLogonID = NetClient3.SyncLogon(iLogonType, tNormal.getPointer(), tNormal.iSize);
|
||||
}
|
||||
if (m_iLogonID >= 0)
|
||||
{
|
||||
System.out.println("NetClient_LogonSync success:" + "iLogonType=" + iLogonType + ", m_iLogonID=" + m_iLogonID);
|
||||
return 0;
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCLOGON_TIMEOUT == m_iLogonID)
|
||||
{
|
||||
System.out.println("NetClient_LogonSync Timeout!");
|
||||
return -1;
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCLOGON_USENAME_ERROR == m_iLogonID)
|
||||
{
|
||||
System.out.println("NetClient_LogonSync username error!");
|
||||
return -1;
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCLOGON_USRPWD_ERROR == m_iLogonID)
|
||||
{
|
||||
System.out.println("NetClient_LogonSync password error!");
|
||||
return -1;
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCLOGON_PWDERRTIMES_OVERRUN == m_iLogonID)
|
||||
{
|
||||
System.out.println("NetClient_LogonSync passwor times overrun!");
|
||||
return -1;
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCLOGON_NET_ERROR == m_iLogonID)
|
||||
{
|
||||
System.out.println("NetClient_LogonSync net error!");
|
||||
return -1;
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCLOGON_PORT_ERROR == m_iLogonID)
|
||||
{
|
||||
System.out.println("NetClient_LogonSync port error!");
|
||||
return -1;
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCLOGON_UNKNOW_ERROR == m_iLogonID)
|
||||
{
|
||||
System.out.println("NetClient_LogonSync unknow error!");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("NetClient_LogonSync fail! iRet=" + m_iLogonID);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void Logoff()
|
||||
{
|
||||
//logout
|
||||
if (m_iLogonID >= 0) {
|
||||
int iRet = NetClient3.Logoff(m_iLogonID);
|
||||
m_iLogonID = -1;
|
||||
System.out.println("Logoff(" + iRet + ")");
|
||||
}
|
||||
}
|
||||
|
||||
NVSSDK3.RAWFRAME_NOTIFY cbkRawFrame = new NVSSDK3.RAWFRAME_NOTIFY() {
|
||||
public void rawFrameNotify(int _iConnectID, Pointer _pcData, int _iLen, NVSSDK3.RAWFRAME_INFO _ptRawFrameInfo, Pointer _lpUserData) {
|
||||
//print data information
|
||||
System.out.println("recvRawData: _iConnectID=" + _iConnectID + ", _iLen=" + _iLen + ", nType=" + _ptRawFrameInfo.nType + ", input 11 stop download.");
|
||||
|
||||
//The upper layer can save and process bare stream data
|
||||
if (null != _pcData && 0 != _iLen) {
|
||||
//SaveRawData(_ptRawFrameInfo.nType, _pcData, _iLen);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NVSSDK3.FULLFRAME_NOTIFY_V4 cbkPrivateFullFrame = new NVSSDK3.FULLFRAME_NOTIFY_V4() {
|
||||
public void fullFrameNotifyV4(int _iConnectID, int _iStreamType, Pointer _pcData, int _iLen, Pointer _pvHeader, Pointer _pvUserData) {
|
||||
//print data information
|
||||
System.out.println("recvPrivateData: _iConnectID=" + _iConnectID + ", _iStreamType=" + _iStreamType + ", _iLen=" + _iLen);
|
||||
|
||||
//The upper layer can save and process bare stream data
|
||||
if (null != _pcData && 0 != _iLen) {
|
||||
//TODO:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public int StartRealPlay()
|
||||
{
|
||||
Scanner scanInput = new Scanner(System.in);
|
||||
int iRet = NVSSDK3.RET_FAILED;
|
||||
int iChanTotalCount = 0;
|
||||
int iDigitalChanCount = 0;
|
||||
int iVideoChan = 0;
|
||||
NVSSDK3.NetClientPara tVideoPara = new NVSSDK3.NetClientPara();
|
||||
|
||||
//Get the total number of channels
|
||||
IntByReference piChanTotalCount = new IntByReference();
|
||||
iRet = NetClient3.GetChannelNum(m_iLogonID, piChanTotalCount);
|
||||
if (NVSSDK3.RET_SUCCESS != iRet)
|
||||
{
|
||||
System.out.println("NetClient_GetChannelNum fail iRet=" + iRet);
|
||||
return -1;
|
||||
}
|
||||
iChanTotalCount = piChanTotalCount.getValue();
|
||||
|
||||
//Get the total number of nvr digital channels, only for nvr series devices
|
||||
IntByReference piDigitalChanCount = new IntByReference();
|
||||
iRet = NetClient3.GetDigitalChannelNum(m_iLogonID, piDigitalChanCount);
|
||||
if (NVSSDK3.RET_SUCCESS != iRet)
|
||||
{
|
||||
System.out.println("NetClient_GetDigitalChannelNum fail iRet=" + iRet);
|
||||
return -1;
|
||||
}
|
||||
iDigitalChanCount = piDigitalChanCount.getValue();
|
||||
System.out.println("iChanTotalCount=" + iChanTotalCount + ", iDigitalChanCount=" + iDigitalChanCount);
|
||||
System.out.println("Input video Channel Number[0-" + (iChanTotalCount - 1) + "](default:0):");
|
||||
iVideoChan = scanInput.nextInt();
|
||||
System.out.println("1-private tcp connect, 2-private udp connect, 3-private multicast connect, 6-rtsp stream via RTP-over-TCP, 7-rtsp stream via RTP-over-UDP");
|
||||
System.out.println("8-rtsp stream via RTP-over-Multicast, 9-rtsps stream via SRTP-over-UDP, 10-rtsps stream via SRTP-over-Multicast");
|
||||
System.out.println("Input net mode(default is 1-private tcp connect):");
|
||||
int iNetMode = scanInput.nextInt();
|
||||
tVideoPara.iSize = tVideoPara.size();
|
||||
tVideoPara.tCltInfo.m_iServerID = m_iLogonID; //logon handle
|
||||
tVideoPara.tCltInfo.m_iChannelNo = iVideoChan;
|
||||
tVideoPara.tCltInfo.m_iStreamNO = 0; //0--main stream, 1--sub stream
|
||||
tVideoPara.tCltInfo.m_iNetMode = iNetMode;
|
||||
tVideoPara.tCltInfo.m_iTimeout = 20;
|
||||
tVideoPara.pCbkFullFrm = cbkPrivateFullFrame;
|
||||
tVideoPara.pvCbkFullFrmUsrData = null;
|
||||
tVideoPara.pCbkRawFrm = cbkRawFrame;
|
||||
tVideoPara.pvCbkRawFrmUsrData = null;
|
||||
tVideoPara.pvWnd = null; //console demo not show video
|
||||
tVideoPara.write();
|
||||
|
||||
IntByReference piConnectID = new IntByReference();
|
||||
iRet = NetClient3.SyncRealPlay(piConnectID, tVideoPara, tVideoPara.iSize);
|
||||
if (NVSSDK3.RET_SUCCESS == iRet)
|
||||
{
|
||||
m_iConnectID = piConnectID.getValue();
|
||||
System.out.println("NetClient_StartRecvSync Success! uiRecvID=" + m_iConnectID);
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCREALPLAY_TIMEOUT == iRet)
|
||||
{
|
||||
System.out.println("NetClient_StartRecvSync Timeout!");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("NetClient_StartRecvSync fail!iRet=" + iRet);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int StopRealPlay()
|
||||
{
|
||||
if (m_iConnectID >= 0)
|
||||
{
|
||||
NetClient3.StopRecv(m_iConnectID);
|
||||
m_iConnectID = -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int SyncQueryFile()
|
||||
{
|
||||
//Users can modify the query time period by themselves to ensure that there is a video in the modified time period
|
||||
NVSSDK3.NETFILE_QUERY_V5 tQueryFileV5 = new NVSSDK3.NETFILE_QUERY_V5();
|
||||
tQueryFileV5.iBufSize = tQueryFileV5.size();
|
||||
tQueryFileV5.iQueryChannelNo = 0; //query channel no, 0x7FFFFFFF means query all channel
|
||||
tQueryFileV5.iStreamNo = 0; //query stream number, 0-main stream, 1-sub stream
|
||||
tQueryFileV5.iType = 0xFF; //File type: 0-All, 1-AVstream, 2-picture
|
||||
|
||||
|
||||
//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
|
||||
tQueryFileV5.tStartTime.iYear = (short)year;
|
||||
tQueryFileV5.tStartTime.iMonth = (short)month;
|
||||
tQueryFileV5.tStartTime.iDay = (short)day;
|
||||
tQueryFileV5.tStartTime.iHour = 0;
|
||||
tQueryFileV5.tStartTime.iMinute = 0;
|
||||
tQueryFileV5.tStartTime.iSecond = 0;
|
||||
// query end time
|
||||
tQueryFileV5.tStopTime.iYear = (short)year;
|
||||
tQueryFileV5.tStopTime.iMonth = (short)month;
|
||||
tQueryFileV5.tStopTime.iDay = (short)day;
|
||||
tQueryFileV5.tStopTime.iHour = (short)hour;
|
||||
tQueryFileV5.tStopTime.iMinute = (short)minute;
|
||||
tQueryFileV5.tStopTime.iSecond = (short)second;
|
||||
|
||||
tQueryFileV5.iPageSize = 20; //The page size of each query, that is, the number of records per query
|
||||
tQueryFileV5.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
|
||||
tQueryFileV5.iFiletype = 1; //File type 0:all,1:Video,2:picture
|
||||
tQueryFileV5.iTriggerType = 0x7FFFFFFF;
|
||||
tQueryFileV5.iTrigger = 0;
|
||||
tQueryFileV5.iQueryChannelCount = 1; //Number of channels for this query, some nvr supports batch query use, default single channel query can be used
|
||||
NVSSDK3.ArrayQueryFileChannel arrayQueryFileChannel = new NVSSDK3.ArrayQueryFileChannel(); //Batch query channel array, default query by single channel
|
||||
NVSSDK3.QueryFileChannel tQueryFileChannel0 = new NVSSDK3.QueryFileChannel();
|
||||
NVSSDK3.QueryFileChannel tQueryFileChannel1 = new NVSSDK3.QueryFileChannel();
|
||||
tQueryFileChannel0.iChannelNo = 0;
|
||||
tQueryFileChannel0.iStreamNo = 0;
|
||||
tQueryFileChannel1.iChannelNo = 0;
|
||||
tQueryFileChannel1.iStreamNo = 1;
|
||||
arrayQueryFileChannel.tArry[0] = tQueryFileChannel0;
|
||||
arrayQueryFileChannel.tArry[1] = tQueryFileChannel1;
|
||||
tQueryFileV5.ptChannelList = arrayQueryFileChannel.getPointer();
|
||||
tQueryFileV5.iBufferSize = tQueryFileChannel0.size(); //Query structure size
|
||||
tQueryFileV5.write();
|
||||
|
||||
NVSSDK3.NVS_FILE_DATA tSingleData = new NVSSDK3.NVS_FILE_DATA();
|
||||
NVSSDK3.QueryFileResult tResult = new NVSSDK3.QueryFileResult();
|
||||
|
||||
int iOutTotalLen = 20 * tSingleData.size();
|
||||
int iSingleLen = tSingleData.size();
|
||||
|
||||
int iRet = NetClient3.SyncQuery(m_iLogonID, 0, NVSSDK3.CMD_NETFILE_QUERY_FILE, tQueryFileV5.getPointer(), tQueryFileV5.size(), tResult.getPointer(), iOutTotalLen, iSingleLen);
|
||||
if (iRet < 0)
|
||||
{
|
||||
System.out.println("Err: NetClient_Query_V5");
|
||||
return -1;
|
||||
}
|
||||
|
||||
tQueryFileV5.read();
|
||||
tResult.read();
|
||||
System.out.println("TotalCount=" + tQueryFileV5.iTotalQueryCount + ", CurrentCount=" + tQueryFileV5.iCurQueryCount);
|
||||
for(int i = 0; i < tQueryFileV5.iCurQueryCount; ++i)
|
||||
{
|
||||
String strFileName = new String(tResult.tArry[i].cFileName).trim();
|
||||
int iStartYear = tResult.tArry[i].tStartTime.iYear;
|
||||
int iStartMonth = tResult.tArry[i].tStartTime.iMonth;
|
||||
int iStartDay = tResult.tArry[i].tStartTime.iDay;
|
||||
int iStartHour = tResult.tArry[i].tStartTime.iHour;
|
||||
int iStartMinute = tResult.tArry[i].tStartTime.iMinute;
|
||||
int iStartSecond = tResult.tArry[i].tStartTime.iSecond;
|
||||
int iStopYear = tResult.tArry[i].tStopTime.iYear;
|
||||
int iStopMonth = tResult.tArry[i].tStopTime.iMonth;
|
||||
int iStopDay = tResult.tArry[i].tStopTime.iDay;
|
||||
int iStopHour = tResult.tArry[i].tStopTime.iHour;
|
||||
int iStopMinute = tResult.tArry[i].tStopTime.iMinute;
|
||||
int iStopSecond = tResult.tArry[i].tStopTime.iSecond;
|
||||
System.out.println("fileIdx=" + i + ", fileName=" + strFileName
|
||||
+ ", chNo=" + tResult.tArry[i].iChannel + ", fileSize=" + tResult.tArry[i].iFileSize
|
||||
+ ", fileStartTime=" + iStartYear + "-" + iStartMonth + "-" + iStartDay + "-"
|
||||
+ iStartHour + "-" + iStartMinute + "-" + iStartSecond
|
||||
+ ", fileStopTime=" + iStopYear + "-" + iStopMonth + "-" + iStopDay + "-"
|
||||
+ iStopHour + "-" + iStopMinute + "-" + iStopSecond);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int SyncQueryLog()
|
||||
{
|
||||
|
||||
//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
|
||||
|
||||
NVSSDK3.NVS_LOG_QUERY tQueryLog = new NVSSDK3.NVS_LOG_QUERY();
|
||||
tQueryLog.iChannelNo = 0xFF; //Query all channels
|
||||
tQueryLog.iLogType = 0xFF; //0, syslog, 1, warning, 2, alarm, 3, action, 4, user, 5, other, 0xFF, all types
|
||||
tQueryLog.iLanguage = 1; //0, English; 1, GB2312 simplified; 2, BIG5 traditional; 3, Korean; 4, Spanish; 5, Italian,
|
||||
tQueryLog.iPageSize = 10; //The page size of each query is 20
|
||||
tQueryLog.iPageNo = 0; //Query the 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
|
||||
tQueryLog.tStartTime.iYear = (short)year;
|
||||
tQueryLog.tStartTime.iMonth = (short)month;
|
||||
tQueryLog.tStartTime.iDay = (short)day;
|
||||
tQueryLog.tStartTime.iHour = 0;
|
||||
tQueryLog.tStartTime.iMinute = 0;
|
||||
tQueryLog.tStartTime.iSecond = 0;
|
||||
tQueryLog.tStopTime.iYear = (short)year;
|
||||
tQueryLog.tStopTime.iMonth = (short)month;
|
||||
tQueryLog.tStopTime.iDay = (short)day;
|
||||
tQueryLog.tStopTime.iHour = (short)hour;
|
||||
tQueryLog.tStopTime.iMinute = (short)minute;
|
||||
tQueryLog.tStopTime.iSecond = (short)second;
|
||||
tQueryLog.write();
|
||||
|
||||
NVSSDK3.NVS_LOG_DATA tSingleData = new NVSSDK3.NVS_LOG_DATA();
|
||||
NVSSDK3.QueryLogResult tResult = new NVSSDK3.QueryLogResult();
|
||||
|
||||
int iOutTotalLen = 20 * tSingleData.size();
|
||||
int iSingleLen = tSingleData.size();
|
||||
|
||||
int iRet = NetClient3.SyncQuery(m_iLogonID, 0, NVSSDK3.CMD_NETFILE_QUERY_LOG, tQueryLog.getPointer(), tQueryLog.size(), tResult.getPointer(), iOutTotalLen, iSingleLen);
|
||||
if (iRet < 0)
|
||||
{
|
||||
System.out.println("Err: NetClient_Query_V5 fail!iRet=" + iRet);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tResult.read();
|
||||
int iTotalCount = 0;
|
||||
int iCurrentCount = 0;
|
||||
IntByReference piTotalCount = new IntByReference();
|
||||
IntByReference piCurrentCount = new IntByReference();
|
||||
iRet = NetClient3.NetLogGetLogCount(m_iLogonID, piTotalCount, piCurrentCount);
|
||||
if (iRet < 0)
|
||||
{
|
||||
System.out.println("Err: NetClient_NetLogGetLogCount fail!iRet=" + iRet);
|
||||
return -1;
|
||||
}
|
||||
|
||||
iTotalCount = piTotalCount.getValue();
|
||||
iCurrentCount = piCurrentCount.getValue();
|
||||
System.out.println("TotalCount=" + iTotalCount + ", CurrentCount=" + iCurrentCount);
|
||||
for(int i = 0; i < iCurrentCount; ++i)
|
||||
{
|
||||
String strLogContent = new String(tResult.tArry[i].szLogContent).trim();
|
||||
System.out.println("Log" + i + ":" + tResult.tArry[i].iLogType + ", " + strLogContent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int SyncSuspendVca()
|
||||
{
|
||||
NVSSDK3.VCASuspend tInPara = new NVSSDK3.VCASuspend();
|
||||
tInPara.iStatus = 0; //Status(0:Suspend intelligent analysis 1:Open intelligent analysis)
|
||||
tInPara.iDevType = 0; //0-IPC, 1-NVR
|
||||
tInPara.write();
|
||||
|
||||
NVSSDK3.VCASuspendResult tOutResult = new NVSSDK3.VCASuspendResult();
|
||||
tOutResult.iBufSize = tOutResult.size();
|
||||
tOutResult.iDevType = 0;
|
||||
tOutResult.write();
|
||||
int iRet = NetClient3.SyncSetDevCfg(m_iLogonID, 0, NVSSDK3.SYNC_NET_CLIENT_VCA_SUSPEND, tInPara.getPointer(), tInPara.size(), tOutResult.getPointer(), tOutResult.size());
|
||||
tOutResult.read();
|
||||
if (NVSSDK3.RET_SUCCESS == iRet)
|
||||
{
|
||||
System.out.println("---------- Suspend Vca success!" + "iRet="+iRet + "iResult"+ tOutResult.iResult);
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCSUSPENDVCA_CONFIGING == iRet)
|
||||
{
|
||||
System.out.println("Suspend Vca fail, Vca Configing by other client!");
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCSUSPENDVCA_FAIL == iRet)
|
||||
{
|
||||
System.out.println("Suspend Vca fail, device not return code!");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int SyncOpenVca()
|
||||
{
|
||||
NVSSDK3.VCASuspend tInPara = new NVSSDK3.VCASuspend();
|
||||
tInPara.iStatus = 1; //Status(0:Suspend intelligent analysis 1:Open intelligent analysis)
|
||||
tInPara.iDevType = 0; //0-IPC, 1-NVR
|
||||
tInPara.write();
|
||||
|
||||
NVSSDK3.VCASuspendResult tOutResult = new NVSSDK3.VCASuspendResult();
|
||||
tOutResult.iBufSize = tOutResult.size();
|
||||
tOutResult.iDevType = 0;
|
||||
tOutResult.write();
|
||||
int iRet = NetClient3.SyncSetDevCfg(m_iLogonID, 0, NVSSDK3.SYNC_NET_CLIENT_VCA_SUSPEND, tInPara.getPointer(), tInPara.size(), tOutResult.getPointer(), tOutResult.size());
|
||||
if (NVSSDK3.RET_SUCCESS == iRet)
|
||||
{
|
||||
System.out.println("Open Vca success!");
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCOPENVCA_CONFIGING == iRet)
|
||||
{
|
||||
System.out.println("Open Vca fail, Vca Configing by other client!");
|
||||
}
|
||||
else if (NVSSDK3.RET_SYNCOPENVCA_FAIL == iRet)
|
||||
{
|
||||
System.out.println("Open Vca fail, device not return code!");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int downloadByFileMode()
|
||||
{
|
||||
Scanner scanInput = new Scanner(System.in);
|
||||
int iRet = NVSSDK3.RET_FAILED;
|
||||
NVSSDK3.DOWNLOAD_FILE tFileInfo = new NVSSDK3.DOWNLOAD_FILE();
|
||||
tFileInfo.m_iSize = tFileInfo.size();
|
||||
tFileInfo.m_iSaveFileType = NVSSDK3.DOWNLOAD_FILE_TYPE_SDV;
|
||||
System.out.print("Please enter the name of the file you want 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
|
||||
tFileInfo.m_cLocalFilename = strDownloadFileName.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 iConnectID = new IntByReference();
|
||||
iRet = NetClient3.NetFileDownload(iConnectID, m_iLogonID, NVSSDK3.DOWNLOAD_CMD_FILE, tFileInfo.getPointer(), tFileInfo.size());
|
||||
if (NVSSDK3.RET_SUCCESS == iRet) {
|
||||
//Set the naked streaming callback, receive audio and video naked streaming data in the callback
|
||||
m_iConnectID = iConnectID.getValue();
|
||||
NetClient3.SetRawFrameCallBack(m_iConnectID, cbkRawFrame, null);
|
||||
//Adjust the speed
|
||||
NVSSDK3.DOWNLOAD_CONTROL tControl = new NVSSDK3.DOWNLOAD_CONTROL();
|
||||
tControl.m_iSize = tControl.size();
|
||||
tControl.m_iPosition = -1;
|
||||
tControl.m_iSpeed = 16;
|
||||
tControl.m_iReqMode = 1;
|
||||
tControl.write();
|
||||
iRet = NetClient3.NetFileDownload(iConnectID, m_iLogonID, NVSSDK3.DOWNLOAD_CMD_CONTROL, tControl.getPointer(), tControl.size());
|
||||
} else {
|
||||
System.err.println("NetFileDownload:DOWNLOAD_CMD_FILE fail! iRet=" + iRet);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return iRet;
|
||||
};
|
||||
|
||||
public int downloadByTimespanMode()
|
||||
{
|
||||
NVSSDK3.DOWNLOAD_TIMESPAN tDownloadTimeSpan = new NVSSDK3.DOWNLOAD_TIMESPAN();
|
||||
tDownloadTimeSpan.m_iSize = tDownloadTimeSpan.size();
|
||||
tDownloadTimeSpan.m_iSaveFileType = NVSSDK3.DOWNLOAD_FILE_TYPE_SDV;
|
||||
tDownloadTimeSpan.m_iFileFlag = 0; //0:Download multiple files 1:Download into a single file
|
||||
String strLocalSaveFileName = new String("myTimespanDownload.sdv");
|
||||
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
|
||||
//Download start time by time period
|
||||
tDownloadTimeSpan.m_tTimeBegin.iYear = 2019;
|
||||
tDownloadTimeSpan.m_tTimeBegin.iMonth = 8;
|
||||
tDownloadTimeSpan.m_tTimeBegin.iDay = 22;
|
||||
tDownloadTimeSpan.m_tTimeBegin.iHour = 11;
|
||||
tDownloadTimeSpan.m_tTimeBegin.iMinute = 30;
|
||||
tDownloadTimeSpan.m_tTimeBegin.iSecond = 0;
|
||||
//Download end time by time period
|
||||
tDownloadTimeSpan.m_tTimeEnd.iYear = 2019;
|
||||
tDownloadTimeSpan.m_tTimeEnd.iMonth = 8;
|
||||
tDownloadTimeSpan.m_tTimeEnd.iDay = 22;
|
||||
tDownloadTimeSpan.m_tTimeEnd.iHour = 11;
|
||||
tDownloadTimeSpan.m_tTimeEnd.iMinute = 36;
|
||||
tDownloadTimeSpan.m_tTimeEnd.iSecond = 0;
|
||||
|
||||
tDownloadTimeSpan.m_iPosition = -1; //Using the positioning function
|
||||
tDownloadTimeSpan.m_iSpeed = 32; //Download speed, maximum 32, old devices are prone to interruptions when downloading at the maximum speed, so the speed can be adjusted to 16 times after the download is successful
|
||||
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 = NetClient3.NetFileDownload(iConnID, m_iLogonID, NVSSDK3.DOWNLOAD_CMD_TIMESPAN, tDownloadTimeSpan.getPointer(), tDownloadTimeSpan.size());
|
||||
if (NVSSDK3.RET_SUCCESS == iRet)
|
||||
{
|
||||
//Set the naked streaming callback, receive audio and video naked streaming data in the callback
|
||||
m_iConnectID = iConnID.getValue();
|
||||
NetClient3.SetRawFrameCallBack(m_iConnectID, cbkRawFrame, null);
|
||||
//Adjust the speed
|
||||
NVSSDK3.DOWNLOAD_CONTROL tControl = new NVSSDK3.DOWNLOAD_CONTROL();
|
||||
tControl.m_iSize = tControl.size();
|
||||
tControl.m_iPosition = -1;
|
||||
tControl.m_iSpeed = 16;
|
||||
tControl.m_iReqMode = 1;
|
||||
tControl.write();
|
||||
NetClient3.NetFileDownload(iConnID, m_iLogonID, NVSSDK3.DOWNLOAD_CMD_CONTROL, tControl.getPointer(), tControl.size());
|
||||
} else {
|
||||
System.err.println("NetFileDownload:DOWNLOAD_CMD_TIMESPAN fail! iRet=" + iRet);
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
public void stopDownload()
|
||||
{
|
||||
if (m_iConnectID >= 0) {
|
||||
int iRet = NetClient3.NetFileStopDownloadFile(m_iConnectID);
|
||||
m_iConnectID = -1;
|
||||
System.out.println("NetFileStopDownloadFile(" + iRet + ")");
|
||||
}
|
||||
}
|
||||
|
||||
NVSSDK3.MAIN_NOTIFY cbkMain = new NVSSDK3.MAIN_NOTIFY() {
|
||||
public void MainNotify(int iLogonID, int wParam, Pointer lParam, Pointer noitfyUserData) {
|
||||
int iMsgType = wParam & 0xFFFF;
|
||||
switch (iMsgType) {
|
||||
case NVSSDK3.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);
|
||||
}
|
||||
NetClient3.NetFileStopDownloadFile(m_iConnectID);
|
||||
break;
|
||||
} case NVSSDK3.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);
|
||||
}
|
||||
NetClient3.NetFileStopDownloadFile(m_iConnectID);
|
||||
break;
|
||||
} case NVSSDK3.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);
|
||||
}
|
||||
NetClient3.NetFileStopDownloadFile(m_iConnectID);
|
||||
break;
|
||||
} default: break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NVSSDK3.ALARM_NOTIFY cbkAlarm = new NVSSDK3.ALARM_NOTIFY() {
|
||||
public void AlarmNotify(int _iLogonID, int _iChannel,
|
||||
int _iAlarmState, int _iAlarmType, Pointer _pUserData) {
|
||||
}
|
||||
};
|
||||
|
||||
NVSSDK3.PARACHANGE_NOTIFY cbkParaChange = new NVSSDK3.PARACHANGE_NOTIFY() {
|
||||
public void ParaChangeNotify(int iLogonID, int iChannel, int paraType,
|
||||
Pointer para, Pointer noitfyUserData) {
|
||||
}
|
||||
};
|
||||
|
||||
NVSSDK3.RECVDATA_NOTIFY cbkRecvData = new NVSSDK3.RECVDATA_NOTIFY() {
|
||||
public void RecvDataNotify(int _iConnectID, Pointer data, int len, int _iFlag,
|
||||
Pointer _lpUserData) {
|
||||
System.out.println("[RECVDATA_NOTIFY] ConnID(" + _iConnectID + "),DataLen("
|
||||
+ len + ")");
|
||||
}
|
||||
};
|
||||
|
||||
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(NVSSDK3.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;
|
||||
}
|
||||
|
||||
public static void main(String args[])
|
||||
{
|
||||
System.out.println("SyncJavaDemo!");
|
||||
SyncBusiness tSyncBusiness = new SyncBusiness();
|
||||
|
||||
//Initialize the SDK
|
||||
tSyncBusiness.sdkInit();
|
||||
|
||||
//Call the SDK interface to implement business functions
|
||||
tSyncBusiness.makeOptCmd();
|
||||
tSyncBusiness.testSdkApi();
|
||||
|
||||
//Deinitialize the SDK and clean up the SDK resources
|
||||
tSyncBusiness.sdkUnInit();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,712 @@
|
|||
package com.whdc.video;
|
||||
|
||||
import com.sun.jna.Callback;
|
||||
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.ptr.PointerByReference;
|
||||
import com.sun.jna.win32.StdCallLibrary.StdCallCallback;
|
||||
|
||||
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 com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.PointerByReference;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class NetClient1 {
|
||||
|
||||
private static NVSSDK1 nvssdk = (NVSSDK1)(System.getProperty("os.name").toLowerCase().startsWith("win")? Native.loadLibrary("NVSSDK.dll",NVSSDK1.class):Native.loadLibrary("libnvssdk.so", NVSSDK1.class));
|
||||
// private static NVSSDK1 nvssdk = NativeLibraryLoader.loadLibraryFromLib(
|
||||
// NVSSDK1.class, "NVSSDK.dll", "libnvssdk.so"
|
||||
// );
|
||||
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,342 @@
|
|||
package com.whdc.websocket;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FLVEncoder {
|
||||
|
||||
private static final byte[] FLV_HEADER = new byte[] {
|
||||
'F', 'L', 'V', // FLV标识
|
||||
0x01, // 版本1
|
||||
0x05, // 音频+视频标志
|
||||
0x00, 0x00, 0x00, 0x09 // Header长度9
|
||||
};
|
||||
|
||||
private static final byte[] FLV_END_METADATA = new byte[]{0, 0, 9}; // AMF数组结束
|
||||
|
||||
/**
|
||||
* 生成FLV Header
|
||||
*/
|
||||
public static byte[] createFlvHeader() {
|
||||
return FLV_HEADER.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成FLV Metadata Tag
|
||||
*/
|
||||
public static byte[] createMetadata(int width, int height, double frameRate) {
|
||||
try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
// Script Tag Header
|
||||
baos.write(0x12); // TagType: Script (18)
|
||||
|
||||
// DataSize占位 (先写0,后面填充)
|
||||
baos.write(new byte[]{0, 0, 0});
|
||||
|
||||
// Timestamp (3字节) + Extended Timestamp (1字节)
|
||||
baos.write(new byte[]{0, 0, 0, 0});
|
||||
|
||||
// StreamID (3字节,总是0)
|
||||
baos.write(new byte[]{0, 0, 0});
|
||||
|
||||
// AMF数据开始
|
||||
baos.write(0x02); // AMF String type
|
||||
|
||||
// "onMetaData" 字符串
|
||||
String onMetaData = "onMetaData";
|
||||
baos.write((byte)((onMetaData.length() >> 8) & 0xFF));
|
||||
baos.write((byte)(onMetaData.length() & 0xFF));
|
||||
baos.write(onMetaData.getBytes());
|
||||
|
||||
baos.write(0x08); // AMF ECMA Array type
|
||||
|
||||
// 属性数量 (5个)
|
||||
writeIntBE(baos, 5);
|
||||
|
||||
// 宽度
|
||||
writeAMFProperty(baos, "width", width);
|
||||
|
||||
// 高度
|
||||
writeAMFProperty(baos, "height", height);
|
||||
|
||||
// 视频编码ID (7=AVC/H.264)
|
||||
writeAMFProperty(baos, "videocodecid", 7);
|
||||
|
||||
// 帧率
|
||||
writeAMFProperty(baos, "framerate", frameRate);
|
||||
|
||||
// 音频编码ID (10=AAC)
|
||||
writeAMFProperty(baos, "audiocodecid", 10);
|
||||
|
||||
// AMF数组结束标记
|
||||
baos.write(FLV_END_METADATA);
|
||||
|
||||
byte[] tagData = baos.toByteArray();
|
||||
int dataSize = tagData.length - 11; // 减去11字节的Tag Header
|
||||
|
||||
// 填充DataSize
|
||||
tagData[1] = (byte)((dataSize >> 16) & 0xFF);
|
||||
tagData[2] = (byte)((dataSize >> 8) & 0xFF);
|
||||
tagData[3] = (byte)(dataSize & 0xFF);
|
||||
|
||||
return tagData;
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成AVC Video Tag
|
||||
*/
|
||||
public static byte[] createAVCVideoTag(byte[] nalData, boolean isKeyFrame,
|
||||
long timestamp, byte[] sps, byte[] pps) {
|
||||
try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
// Tag Header
|
||||
baos.write(0x09); // TagType: Video
|
||||
|
||||
// DataSize占位
|
||||
baos.write(new byte[]{0, 0, 0});
|
||||
|
||||
// Timestamp (3字节) + Extended Timestamp (1字节)
|
||||
baos.write((byte)((timestamp >> 16) & 0xFF));
|
||||
baos.write((byte)((timestamp >> 8) & 0xFF));
|
||||
baos.write((byte)(timestamp & 0xFF));
|
||||
baos.write((byte)(timestamp >> 24)); // Extended timestamp
|
||||
|
||||
// StreamID
|
||||
baos.write(new byte[]{0, 0, 0});
|
||||
|
||||
// Video Tag Header
|
||||
byte frameType = isKeyFrame ? (byte)0x10 : (byte)0x20; // 1=关键帧,2=非关键帧
|
||||
byte codecID = 0x07; // AVC
|
||||
|
||||
baos.write(frameType | codecID); // FrameType + CodecID
|
||||
|
||||
// 如果是关键帧,需要发送AVCDecoderConfigurationRecord
|
||||
if (isKeyFrame && sps != null && pps != null) {
|
||||
baos.write(0x00); // AVC packet type: 0 = AVC sequence header
|
||||
baos.write(0x00); // Composition time (3字节)
|
||||
baos.write(0x00);
|
||||
baos.write(0x00);
|
||||
|
||||
// AVC Decoder Configuration Record
|
||||
ByteArrayOutputStream avcConfig = new ByteArrayOutputStream();
|
||||
avcConfig.write(0x01); // configurationVersion
|
||||
avcConfig.write(sps[1]); // AVCProfileIndication
|
||||
avcConfig.write(sps[2]); // profile_compatibility
|
||||
avcConfig.write(sps[3]); // AVCLevelIndication
|
||||
avcConfig.write(0xFF); // lengthSizeMinusOne: 0xFF表示NALU长度用4字节表示
|
||||
|
||||
// SPS数量 (1个)
|
||||
avcConfig.write(0xE1); // 0xE1 = 1个SPS
|
||||
|
||||
// SPS长度
|
||||
avcConfig.write((byte)(sps.length >> 8));
|
||||
avcConfig.write((byte)(sps.length & 0xFF));
|
||||
|
||||
// SPS数据
|
||||
avcConfig.write(sps);
|
||||
|
||||
// PPS数量 (1个)
|
||||
avcConfig.write(0x01); // 1个PPS
|
||||
|
||||
// PPS长度
|
||||
avcConfig.write((byte)(pps.length >> 8));
|
||||
avcConfig.write((byte)(pps.length & 0xFF));
|
||||
|
||||
// PPS数据
|
||||
avcConfig.write(pps);
|
||||
|
||||
byte[] configData = avcConfig.toByteArray();
|
||||
baos.write(configData);
|
||||
|
||||
} else {
|
||||
// 普通视频帧
|
||||
baos.write(0x01); // AVC packet type: 1 = AVC NALU
|
||||
baos.write(0x00); // Composition time (3字节)
|
||||
baos.write(0x00);
|
||||
baos.write(0x00);
|
||||
|
||||
// NALU长度 (4字节)
|
||||
baos.write((byte)((nalData.length >> 24) & 0xFF));
|
||||
baos.write((byte)((nalData.length >> 16) & 0xFF));
|
||||
baos.write((byte)((nalData.length >> 8) & 0xFF));
|
||||
baos.write((byte)(nalData.length & 0xFF));
|
||||
|
||||
// NALU数据
|
||||
baos.write(nalData);
|
||||
}
|
||||
|
||||
byte[] tagData = baos.toByteArray();
|
||||
int dataSize = tagData.length - 11; // 减去Tag Header
|
||||
|
||||
// 填充DataSize
|
||||
tagData[1] = (byte)((dataSize >> 16) & 0xFF);
|
||||
tagData[2] = (byte)((dataSize >> 8) & 0xFF);
|
||||
tagData[3] = (byte)(dataSize & 0xFF);
|
||||
|
||||
return tagData;
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成Previous Tag Size
|
||||
*/
|
||||
public static byte[] createPreviousTagSize(int tagSize) {
|
||||
byte[] prevSize = new byte[4];
|
||||
prevSize[0] = (byte)((tagSize >> 24) & 0xFF);
|
||||
prevSize[1] = (byte)((tagSize >> 16) & 0xFF);
|
||||
prevSize[2] = (byte)((tagSize >> 8) & 0xFF);
|
||||
prevSize[3] = (byte)(tagSize & 0xFF);
|
||||
return prevSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成空音频Tag(如果没有音频)
|
||||
*/
|
||||
public static byte[] createSilentAudioTag(long timestamp) {
|
||||
try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
// Tag Header
|
||||
baos.write(0x08); // TagType: Audio
|
||||
|
||||
// DataSize: 2字节AAC数据
|
||||
baos.write(0x00);
|
||||
baos.write(0x00);
|
||||
baos.write(0x02);
|
||||
|
||||
// Timestamp
|
||||
baos.write((byte)((timestamp >> 16) & 0xFF));
|
||||
baos.write((byte)((timestamp >> 8) & 0xFF));
|
||||
baos.write((byte)(timestamp & 0xFF));
|
||||
baos.write((byte)(timestamp >> 24)); // Extended
|
||||
|
||||
// StreamID
|
||||
baos.write(new byte[]{0, 0, 0});
|
||||
|
||||
// AAC Audio Specific Config (没有音频数据时的占位)
|
||||
baos.write(0xAF); // AAC, 44.1kHz, stereo
|
||||
baos.write(0x00); // AAC sequence header
|
||||
|
||||
return baos.toByteArray();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeAMFProperty(ByteArrayOutputStream baos, String name, Number value) {
|
||||
try {
|
||||
// 属性名
|
||||
baos.write(0x02); // AMF String type
|
||||
writeIntBE(baos, name.length());
|
||||
baos.write(name.getBytes());
|
||||
|
||||
// 属性值
|
||||
baos.write(0x00); // AMF Number type
|
||||
ByteBuffer buffer = ByteBuffer.allocate(8);
|
||||
buffer.order(ByteOrder.BIG_ENDIAN);
|
||||
buffer.putDouble(value.doubleValue());
|
||||
baos.write(buffer.array());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void writeIntBE(ByteArrayOutputStream baos, int value) {
|
||||
baos.write((byte)((value >> 24) & 0xFF));
|
||||
baos.write((byte)((value >> 16) & 0xFF));
|
||||
baos.write((byte)((value >> 8) & 0xFF));
|
||||
baos.write((byte)(value & 0xFF));
|
||||
}
|
||||
|
||||
/**
|
||||
* H.264 NALU解析器
|
||||
*/
|
||||
public static class H264NaluParser {
|
||||
|
||||
public static final int NALU_TYPE_SPS = 7;
|
||||
public static final int NALU_TYPE_PPS = 8;
|
||||
public static final int NALU_TYPE_IDR = 5;
|
||||
public static final int NALU_TYPE_SLICE = 1;
|
||||
|
||||
/**
|
||||
* 解析NALU类型
|
||||
*/
|
||||
public static int getNaluType(byte[] nalu) {
|
||||
if (nalu.length > 0) {
|
||||
return nalu[0] & 0x1F;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找NALU起始码
|
||||
*/
|
||||
public static int findStartCode(byte[] data, int start) {
|
||||
int limit = data.length - 4;
|
||||
for (int i = start; i <= limit; i++) {
|
||||
// 检查4字节起始码
|
||||
if (data[i] == 0x00 && data[i+1] == 0x00 &&
|
||||
data[i+2] == 0x00 && data[i+3] == 0x01) {
|
||||
return i;
|
||||
}
|
||||
// 检查3字节起始码
|
||||
if (data[i] == 0x00 && data[i+1] == 0x00 && data[i+2] == 0x01) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取所有NALU
|
||||
*/
|
||||
public static List<byte[]> extractNalus(byte[] data) {
|
||||
List<byte[]> nalus = new ArrayList<>();
|
||||
int offset = 0;
|
||||
|
||||
while (offset < data.length) {
|
||||
int start = findStartCode(data, offset);
|
||||
if (start < 0) break;
|
||||
|
||||
// 确定起始码长度
|
||||
int startCodeLen = (data[start+2] == 0x01) ? 3 : 4;
|
||||
int nextStart = findStartCode(data, start + startCodeLen);
|
||||
|
||||
int naluLen;
|
||||
if (nextStart < 0) {
|
||||
naluLen = data.length - (start + startCodeLen);
|
||||
} else {
|
||||
naluLen = nextStart - (start + startCodeLen);
|
||||
}
|
||||
|
||||
if (naluLen > 0) {
|
||||
byte[] nalu = new byte[naluLen];
|
||||
System.arraycopy(data, start + startCodeLen, nalu, 0, naluLen);
|
||||
nalus.add(nalu);
|
||||
}
|
||||
|
||||
if (nextStart < 0) break;
|
||||
offset = nextStart;
|
||||
}
|
||||
|
||||
return nalus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,292 @@
|
|||
package com.whdc.websocket;
|
||||
|
||||
import com.whdc.service.impl.VideoPlayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ServerEndpoint("/ws/video/{streamId}")
|
||||
public class VideoStreamWebSocket {
|
||||
|
||||
private static VideoPlayService videoPlayService;
|
||||
|
||||
private static Map<String, Session> sessions = new ConcurrentHashMap<>();
|
||||
private static Map<String, VideoPlayService.FrameCallback> frameCallbacks = new ConcurrentHashMap<>();
|
||||
private static Map<String, Boolean> flvHeadersSent = new ConcurrentHashMap<>();
|
||||
|
||||
@Autowired
|
||||
public void setVideoPlayService(VideoPlayService videoPlayService) {
|
||||
VideoStreamWebSocket.videoPlayService = videoPlayService;
|
||||
}
|
||||
|
||||
@OnOpen
|
||||
public void onOpen(Session session, @PathParam("streamId") String streamId) {
|
||||
try {
|
||||
sessions.put(streamId, session);
|
||||
flvHeadersSent.put(streamId, false);
|
||||
|
||||
log.info("WebSocket连接建立: {}, Session ID: {}, IP: {}",
|
||||
streamId, session.getId(), session.getRequestURI());
|
||||
|
||||
// 设置消息大小限制
|
||||
session.setMaxBinaryMessageBufferSize(1024 * 1024);
|
||||
session.setMaxTextMessageBufferSize(8192);
|
||||
|
||||
// 检查会话是否存在
|
||||
if (!videoPlayService.isSessionActive(streamId)) {
|
||||
log.warn("视频流会话不存在: {}", streamId);
|
||||
sendErrorMessage(session, "ERROR:视频流会话不存在");
|
||||
cleanupSession(streamId);
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取会话状态,检查是否有回调
|
||||
Map<String, Object> status = videoPlayService.getSessionStatus(streamId);
|
||||
if (status != null) {
|
||||
log.info("会话状态: {}", status);
|
||||
boolean hasCallback = (boolean)status.getOrDefault("hasCallback", false);
|
||||
if (!hasCallback) {
|
||||
log.info("会话没有回调,需要重新设置");
|
||||
}
|
||||
}
|
||||
|
||||
// 创建帧回调
|
||||
VideoPlayService.FrameCallback frameCallback = new VideoPlayService.FrameCallback() {
|
||||
@Override
|
||||
public void onFrame(byte[] frameData, int frameType) {
|
||||
if (frameData != null && frameData.length > 0) {
|
||||
log.info("发送帧数据 - StreamID: {}, Type: {}, Size: {}",
|
||||
streamId, frameType, frameData.length);
|
||||
sendBinaryData(streamId, frameData);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
frameCallbacks.put(streamId, frameCallback);
|
||||
|
||||
// 强制设置帧回调(覆盖原有的)
|
||||
boolean success = videoPlayService.setFrameCallback(streamId, frameCallback);
|
||||
if (!success) {
|
||||
log.error("设置帧回调失败: {}", streamId);
|
||||
|
||||
// 尝试重启流(使用流中的 logonId)
|
||||
restartStreamIfNeeded(streamId, frameCallback);
|
||||
|
||||
sendErrorMessage(session, "ERROR:设置帧回调失败,尝试重启");
|
||||
return;
|
||||
}
|
||||
|
||||
// 发送连接成功消息
|
||||
sendTextMessage(session, "CONNECTED:FLV视频流连接成功");
|
||||
log.info("FLV视频流连接建立成功: {}", streamId);
|
||||
|
||||
// 立即发送一条测试消息,确认连接正常
|
||||
sendTextMessage(session, "READY:开始接收视频流");
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("WebSocket连接建立异常: {}, Error: {}", streamId, e.getMessage(), e);
|
||||
cleanupSession(streamId);
|
||||
}
|
||||
}
|
||||
|
||||
// 添加重启流的方法
|
||||
private void restartStreamIfNeeded(String streamId, VideoPlayService.FrameCallback callback) {
|
||||
try {
|
||||
// 获取会话状态
|
||||
Map<String, Object> status = videoPlayService.getSessionStatus(streamId);
|
||||
if (status != null) {
|
||||
int logonId = (int)status.get("logonId");
|
||||
int connectId = (int)status.get("connectId");
|
||||
|
||||
log.info("尝试重启流: StreamID={}, LogonID={}, ConnectID={}",
|
||||
streamId, logonId, connectId);
|
||||
|
||||
// 先停止
|
||||
videoPlayService.stopStream(streamId);
|
||||
|
||||
// 等待一会儿
|
||||
Thread.sleep(100);
|
||||
|
||||
// TODO: 这里需要获取原始参数重新启动流
|
||||
// 由于没有保存原始参数,可能需要修改架构来支持重启
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("重启流异常: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@OnClose
|
||||
public void onClose(Session session, @PathParam("streamId") String streamId) {
|
||||
try {
|
||||
log.info("WebSocket连接关闭: {}, Session ID: {}", streamId, session.getId());
|
||||
cleanupSession(streamId);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("WebSocket连接关闭异常: {}, Error: {}", streamId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@OnError
|
||||
public void onError(Session session, @PathParam("streamId") String streamId, Throwable error) {
|
||||
try {
|
||||
log.error("WebSocket错误 - StreamID: {}, Session: {}, Error: {}",
|
||||
streamId, session.getId(), error.getMessage(), error);
|
||||
|
||||
cleanupSession(streamId);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("处理WebSocket错误时发生异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@OnMessage
|
||||
public void onMessage(String message, Session session, @PathParam("streamId") String streamId) {
|
||||
try {
|
||||
log.debug("收到控制消息: {} from {}", message, streamId);
|
||||
|
||||
// 处理客户端控制消息
|
||||
switch (message.trim().toUpperCase()) {
|
||||
case "PING":
|
||||
sendTextMessage(session, "PONG");
|
||||
break;
|
||||
|
||||
case "STATUS":
|
||||
Map<String, Object> status = videoPlayService.getSessionStatus(streamId);
|
||||
if (status != null) {
|
||||
String statusMsg = String.format(
|
||||
"STATUS:streamId=%s, frames=%d, connected=%s",
|
||||
streamId,
|
||||
(int)status.getOrDefault("frameCount", 0),
|
||||
sessions.containsKey(streamId)
|
||||
);
|
||||
sendTextMessage(session, statusMsg);
|
||||
} else {
|
||||
sendTextMessage(session, "STATUS:SESSION_NOT_FOUND");
|
||||
}
|
||||
break;
|
||||
|
||||
case "STOP":
|
||||
boolean stopped = videoPlayService.stopStream(streamId);
|
||||
if (stopped) {
|
||||
sendTextMessage(session, "STOPPED");
|
||||
cleanupSession(streamId);
|
||||
} else {
|
||||
sendTextMessage(session, "ERROR:停止失败");
|
||||
}
|
||||
break;
|
||||
|
||||
case "RESTART":
|
||||
// 重新发送FLV Header
|
||||
flvHeadersSent.put(streamId, false);
|
||||
sendTextMessage(session, "RESTART:FLV Header重置");
|
||||
break;
|
||||
|
||||
default:
|
||||
sendTextMessage(session, "UNKNOWN_COMMAND:" + message);
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("处理WebSocket消息异常: {}, Error: {}", streamId, e.getMessage(), e);
|
||||
sendErrorMessage(session, "ERROR:处理消息异常");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送二进制数据(FLV帧)
|
||||
*/
|
||||
private void sendBinaryData(String streamId, byte[] data) {
|
||||
Session session = sessions.get(streamId);
|
||||
if (session == null || !session.isOpen()) {
|
||||
log.debug("Session不存在或已关闭: {}", streamId);
|
||||
cleanupSession(streamId);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ByteBuffer buffer = ByteBuffer.wrap(data);
|
||||
|
||||
// 使用同步发送确保顺序(FLV需要按顺序发送)
|
||||
synchronized (session) {
|
||||
session.getBasicRemote().sendBinary(buffer);
|
||||
}
|
||||
|
||||
// 记录发送统计
|
||||
log.trace("发送FLV数据 - StreamID: {}, Size: {} bytes", streamId, data.length);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("发送二进制数据异常 - StreamID: {}, Error: {}", streamId, e.getMessage());
|
||||
cleanupSession(streamId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送文本消息
|
||||
*/
|
||||
private void sendTextMessage(Session session, String message) {
|
||||
if (session != null && session.isOpen()) {
|
||||
try {
|
||||
session.getAsyncRemote().sendText(message);
|
||||
} catch (Exception e) {
|
||||
log.error("发送文本消息失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送错误消息
|
||||
*/
|
||||
private void sendErrorMessage(Session session, String errorMessage) {
|
||||
sendTextMessage(session, errorMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理会话资源
|
||||
*/
|
||||
private void cleanupSession(String streamId) {
|
||||
try {
|
||||
Session session = sessions.remove(streamId);
|
||||
frameCallbacks.remove(streamId);
|
||||
flvHeadersSent.remove(streamId);
|
||||
|
||||
if (session != null && session.isOpen()) {
|
||||
try {
|
||||
session.close();
|
||||
} catch (IOException e) {
|
||||
log.debug("关闭session时发生异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
log.info("清理会话资源: {}", streamId);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("清理会话资源异常: {}, Error: {}", streamId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活跃连接数
|
||||
*/
|
||||
public static int getActiveConnectionCount() {
|
||||
return sessions.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查指定流是否活跃
|
||||
*/
|
||||
public static boolean isStreamActive(String streamId) {
|
||||
Session session = sessions.get(streamId);
|
||||
return session != null && session.isOpen();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
package com.whdc.websocket;
|
||||
//import com.whdc.service.impl.VideoPlayService;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import javax.websocket.*;
|
||||
//import javax.websocket.server.PathParam;
|
||||
//import javax.websocket.server.ServerEndpoint;
|
||||
//import java.io.IOException;
|
||||
//import java.nio.ByteBuffer;
|
||||
//import java.util.Map;
|
||||
//import java.util.concurrent.ConcurrentHashMap;
|
||||
//
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//@ServerEndpoint("/ws/video/{streamId}")
|
||||
public class VideoStreamWebSocket1 {
|
||||
//
|
||||
// private static VideoPlayService videoPlayService;
|
||||
//
|
||||
// private static Map<String, Session> sessions = new ConcurrentHashMap<>();
|
||||
// private static Map<String, VideoPlayService.FrameCallback> frameCallbacks = new ConcurrentHashMap<>();
|
||||
//
|
||||
// @Autowired
|
||||
// public void setVideoPlayService(VideoPlayService videoPlayService) {
|
||||
// VideoStreamWebSocket.videoPlayService = videoPlayService;
|
||||
// }
|
||||
//
|
||||
// @OnOpen
|
||||
// public void onOpen(Session session, @PathParam("streamId") String streamId) {
|
||||
// try {
|
||||
// sessions.put(streamId, session);
|
||||
// log.info("WebSocket连接建立: {}, Session ID: {}", streamId, session.getId());
|
||||
//
|
||||
// // 检查会话是否存在
|
||||
// if (!videoPlayService.isSessionActive(streamId)) {
|
||||
// log.warn("视频流会话不存在: {}", streamId);
|
||||
// sendErrorMessage(session, "视频流会话不存在: " + streamId);
|
||||
// session.close();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // 创建并保存帧回调
|
||||
// VideoPlayService.FrameCallback frameCallback = new VideoPlayService.FrameCallback() {
|
||||
// @Override
|
||||
// public void onFrame(byte[] frameData, int frameType) {
|
||||
// sendBinaryData(streamId, frameData, frameType);
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// frameCallbacks.put(streamId, frameCallback);
|
||||
//
|
||||
// // 设置帧数据回调
|
||||
// boolean success = videoPlayService.setFrameCallback(streamId, frameCallback);
|
||||
// if (!success) {
|
||||
// log.error("设置帧回调失败: {}", streamId);
|
||||
// sendErrorMessage(session, "设置帧回调失败");
|
||||
// sessions.remove(streamId);
|
||||
// frameCallbacks.remove(streamId);
|
||||
// session.close();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// log.info("帧回调设置成功: {}", streamId);
|
||||
//
|
||||
// // 发送连接成功消息
|
||||
// sendTextMessage(session, "CONNECTED:视频流连接成功");
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("WebSocket连接建立异常: {}, {}", streamId, e.getMessage(), e);
|
||||
// sessions.remove(streamId);
|
||||
// frameCallbacks.remove(streamId);
|
||||
// try {
|
||||
// session.close();
|
||||
// } catch (IOException ex) {
|
||||
// log.error("关闭session异常: {}", ex.getMessage());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @OnClose
|
||||
// public void onClose(Session session, @PathParam("streamId") String streamId) {
|
||||
// try {
|
||||
// log.info("WebSocket连接关闭: {}, Session ID: {}", streamId, session.getId());
|
||||
//
|
||||
// // 移除回调
|
||||
// frameCallbacks.remove(streamId);
|
||||
// sessions.remove(streamId);
|
||||
//
|
||||
// // 停止视频流(可选,根据业务需求决定)
|
||||
// // videoPlayService.stopStream(streamId);
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("WebSocket连接关闭异常: {}, {}", streamId, e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @OnError
|
||||
// public void onError(Session session, @PathParam("streamId") String streamId, Throwable error) {
|
||||
// try {
|
||||
// log.error("WebSocket错误: {}, Session ID: {}, 错误: {}",
|
||||
// streamId, session.getId(), error.getMessage(), error);
|
||||
//
|
||||
// // 移除相关资源
|
||||
// frameCallbacks.remove(streamId);
|
||||
// sessions.remove(streamId);
|
||||
//
|
||||
// // 发送错误消息
|
||||
// sendErrorMessage(session, "WebSocket错误: " + error.getMessage());
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("处理WebSocket错误时发生异常: {}", e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @OnMessage
|
||||
// public void onMessage(String message, Session session, @PathParam("streamId") String streamId) {
|
||||
// try {
|
||||
// log.info("收到消息: {} from {}", message, streamId);
|
||||
//
|
||||
// // 处理客户端消息
|
||||
// switch (message.toUpperCase()) {
|
||||
// case "PING":
|
||||
// sendTextMessage(session, "PONG");
|
||||
// break;
|
||||
// case "STATUS":
|
||||
// Map<String, Object> status = videoPlayService.getSessionStatus(streamId);
|
||||
// sendTextMessage(session, "STATUS:" + (status != null ? status.toString() : "SESSION_NOT_FOUND"));
|
||||
// break;
|
||||
// case "STOP":
|
||||
// videoPlayService.stopStream(streamId);
|
||||
// sendTextMessage(session, "STOPPED");
|
||||
// break;
|
||||
// default:
|
||||
// sendTextMessage(session, "UNKNOWN_COMMAND:" + message);
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("处理WebSocket消息异常: {}, {}", streamId, e.getMessage(), e);
|
||||
// sendErrorMessage(session, "处理消息异常: " + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 发送二进制数据到客户端
|
||||
// */
|
||||
// private void sendBinaryData(String streamId, byte[] data, int frameType) {
|
||||
// Session session = sessions.get(streamId);
|
||||
// if (session == null || !session.isOpen()) {
|
||||
// log.debug("Session不存在或已关闭: {}", streamId);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// // 添加帧类型信息到数据包(可选)
|
||||
// ByteBuffer buffer = ByteBuffer.wrap(data);
|
||||
//
|
||||
// // 使用异步发送提高性能
|
||||
// session.getAsyncRemote().sendBinary(buffer, new SendHandler() {
|
||||
// @Override
|
||||
// public void onResult(SendResult result) {
|
||||
// if (!result.isOK()) {
|
||||
// log.warn("发送二进制数据失败: {}, 异常: {}", streamId, result.getException());
|
||||
// // 发送失败时清理资源
|
||||
// cleanupSession(streamId);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("发送二进制数据异常: {}, {}", streamId, e.getMessage());
|
||||
// cleanupSession(streamId);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 发送文本消息到客户端
|
||||
// */
|
||||
// private void sendTextMessage(Session session, String message) {
|
||||
// if (session != null && session.isOpen()) {
|
||||
// try {
|
||||
// session.getAsyncRemote().sendText(message);
|
||||
// } catch (Exception e) {
|
||||
// log.error("发送文本消息失败: {}", e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 发送错误消息到客户端
|
||||
// */
|
||||
// private void sendErrorMessage(Session session, String errorMessage) {
|
||||
// sendTextMessage(session, "ERROR:" + errorMessage);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 清理会话资源
|
||||
// */
|
||||
// private void cleanupSession(String streamId) {
|
||||
// try {
|
||||
// Session session = sessions.remove(streamId);
|
||||
// frameCallbacks.remove(streamId);
|
||||
//
|
||||
// if (session != null && session.isOpen()) {
|
||||
// session.close();
|
||||
// }
|
||||
//
|
||||
// log.info("清理会话资源: {}", streamId);
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// log.error("清理会话资源异常: {}, {}", streamId, e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取活跃连接数(用于监控)
|
||||
// */
|
||||
// public static int getActiveConnectionCount() {
|
||||
// return sessions.size();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 检查指定流是否活跃
|
||||
// */
|
||||
// public static boolean isStreamActive(String streamId) {
|
||||
// Session session = sessions.get(streamId);
|
||||
// return session != null && session.isOpen();
|
||||
// }
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.whdc.websocket;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
|
||||
@Configuration
|
||||
public class WebSocketConfig {
|
||||
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpointExporter() {
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
server:
|
||||
port: 12117
|
||||
port: 12120
|
||||
|
||||
spring:
|
||||
#数据库配置
|
||||
|
|
@ -27,9 +27,5 @@ logging:
|
|||
mybatis:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
|
||||
mqtt:
|
||||
broker: tcp://120.24.5.249:3189
|
||||
clientId: mqttx_c4d1c22b
|
||||
|
||||
enableMqttListening: true
|
||||
offlineThreshold: 24
|
||||
app:
|
||||
image-save-path: /home/lisai/tdwy/image
|
||||
|
|
@ -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