Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
entrance_api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王琮
entrance_api
Commits
cc80fa48
Commit
cc80fa48
authored
Dec 30, 2022
by
zhangyanduan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 提交大华摄像头抓取图像的测试代码,目前还没有整合到业务中
parent
ad85ce29
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
428 additions
and
28 deletions
+428
-28
AepPushController.java
...rcisoft/integration/aep/Controller/AepPushController.java
+27
-4
IDaHuaVideoService.java
...rcisoft/integration/video/Service/IDaHuaVideoService.java
+3
-0
DahuaVideoServiceImpl.java
...integration/video/Service/impl/DahuaVideoServiceImpl.java
+55
-4
VideoDeviceHandel.java
...g/rcisoft/integration/video/common/VideoDeviceHandel.java
+23
-0
VideoDeviceSDKComm.java
.../rcisoft/integration/video/common/VideoDeviceSDKComm.java
+20
-0
CapturePicCallBack.java
.../rcisoft/integration/video/config/CapturePicCallBack.java
+84
-0
DaHuaVideoInitConfig.java
...cisoft/integration/video/config/DaHuaVideoInitConfig.java
+22
-15
DisConnect.java
...java/org/rcisoft/integration/video/config/DisConnect.java
+12
-4
HaveReConnect.java
...a/org/rcisoft/integration/video/config/HaveReConnect.java
+21
-1
CapturePictureUtils.java
.../rcisoft/integration/video/utils/CapturePictureUtils.java
+91
-0
SpringBeanUtils.java
.../org/rcisoft/integration/video/utils/SpringBeanUtils.java
+67
-0
OssInfoService.java
.../java/org/rcisoft/sys/ossinfo/service/OssInfoService.java
+3
-0
No files found.
src/main/java/org/rcisoft/integration/aep/Controller/AepPushController.java
View file @
cc80fa48
...
@@ -7,11 +7,9 @@ import org.rcisoft.core.anno.CyOpeLogAnno;
...
@@ -7,11 +7,9 @@ import org.rcisoft.core.anno.CyOpeLogAnno;
import
org.rcisoft.core.operlog.enums.CyLogTypeEnum
;
import
org.rcisoft.core.operlog.enums.CyLogTypeEnum
;
import
org.rcisoft.integration.aep.service.IAepPushService
;
import
org.rcisoft.integration.aep.service.IAepPushService
;
import
org.rcisoft.integration.jieLink.dto.JieLinkResultDto
;
import
org.rcisoft.integration.jieLink.dto.JieLinkResultDto
;
import
org.rcisoft.integration.video.Service.IDaHuaVideoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Slf4j
@Slf4j
@RestController
@RestController
...
@@ -22,6 +20,9 @@ public class AepPushController {
...
@@ -22,6 +20,9 @@ public class AepPushController {
private
IAepPushService
aepPushService
;
private
IAepPushService
aepPushService
;
@Autowired
private
IDaHuaVideoService
daHuaVideoService
;
/**
/**
* 门磁推送数据接口
* 门磁推送数据接口
* @param data
* @param data
...
@@ -78,4 +79,26 @@ public class AepPushController {
...
@@ -78,4 +79,26 @@ public class AepPushController {
return
result
;
return
result
;
}
}
/**
* 门磁推送数据接口
* @param data
* @return
*/
@ApiOperation
(
value
=
"大华视频监控设备抓图"
,
notes
=
"大华视频监控设备抓图"
)
@GetMapping
(
value
=
"/grabVideoPic"
)
public
JieLinkResultDto
grabVideoPic
()
{
JieLinkResultDto
result
=
new
JieLinkResultDto
();
boolean
grabFlag
=
daHuaVideoService
.
grabVideoDevicePicData
();
if
(
grabFlag
){
result
.
setCode
(
"200"
);
result
.
setMsg
(
"抓取成功"
);
}
else
{
result
.
setCode
(
"-1"
);
result
.
setMsg
(
"抓取失败"
);
}
return
result
;
}
}
}
src/main/java/org/rcisoft/integration/video/Service/IDaHuaVideoService.java
View file @
cc80fa48
package
org
.
rcisoft
.
integration
.
video
.
Service
;
package
org
.
rcisoft
.
integration
.
video
.
Service
;
import
org.springframework.stereotype.Service
;
/**
/**
* 大华视频监控设备服务
* 大华视频监控设备服务
*/
*/
@Service
public
interface
IDaHuaVideoService
{
public
interface
IDaHuaVideoService
{
/**
/**
...
...
src/main/java/org/rcisoft/integration/video/Service/impl/DahuaVideoServiceImpl.java
View file @
cc80fa48
package
org
.
rcisoft
.
integration
.
video
.
Service
.
impl
;
package
org
.
rcisoft
.
integration
.
video
.
Service
.
impl
;
import
com.sun.jna.Pointer
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.integration.video.Service.IDaHuaVideoService
;
import
org.rcisoft.integration.video.Service.IDaHuaVideoService
;
import
org.rcisoft.integration.video.common.VideoDeviceHandel
;
import
org.rcisoft.integration.video.config.CapturePicCallBack
;
import
org.rcisoft.integration.video.config.DaHuaVideoInitConfig
;
import
org.rcisoft.integration.video.utils.CapturePictureUtils
;
import
org.rcisoft.sys.doorreportdata.entity.DoorReportData
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
/**
/**
* 大华视频监控设备服务
* 大华视频监控设备服务
*/
*/
@Service
@Slf4j
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
class
DahuaVideoServiceImpl
implements
IDaHuaVideoService
{
public
class
DahuaVideoServiceImpl
implements
IDaHuaVideoService
{
@Override
@Override
public
boolean
grabVideoDevicePicData
()
{
public
boolean
grabVideoDevicePicData
()
{
/**
/**
* 先判断是否已经初始化
* 先判断是否已经初始化,
* 2、获取设备的配置信息
* 3、判断设备是否已经登录
* 4、未登录登录 一登录获取登录句柄
* 5、调用抓图工具类
* 6、回调写入数据
*/
*/
VideoDeviceHandel
handel
=
null
;
if
(!
DaHuaVideoInitConfig
.
videoDeviceMap
.
containsKey
(
0L
)){
String
deviceIp
=
"192.168.1.199"
;
int
devicePort
=
37777
;
String
deviceAccount
=
"admin"
;
String
deviceSign
=
"admin123"
;
boolean
login
=
DaHuaVideoInitConfig
.
login
(
deviceIp
,
devicePort
,
deviceAccount
,
deviceSign
);
if
(
login
){
handel
=
DaHuaVideoInitConfig
.
videoDeviceMap
.
get
(
0
l
);
}
}
else
{
handel
=
DaHuaVideoInitConfig
.
videoDeviceMap
.
get
(
0
l
);
if
(
handel
.
isLoginStatus
()){
String
deviceIp
=
"192.168.1.199"
;
int
devicePort
=
37777
;
String
deviceAccount
=
"admin"
;
String
deviceSign
=
"admin123"
;
boolean
login
=
DaHuaVideoInitConfig
.
login
(
deviceIp
,
devicePort
,
deviceAccount
,
deviceSign
);
if
(
login
){
handel
=
DaHuaVideoInitConfig
.
videoDeviceMap
.
get
(
0
l
);
}
}
}
if
(
handel
==
null
||!
handel
.
isLoginStatus
()){
return
false
;
return
false
;
}
}
String
basePath
=
"E:\\DAHUAPIC"
;
String
strFileName
=
basePath
+
"\\"
+
new
Date
().
getTime
()+
".jpg"
;
CapturePicCallBack
callBack
=
new
CapturePicCallBack
(
"11111111"
,
strFileName
);
CapturePictureUtils
.
setSnapRevCallBack
(
callBack
,
null
);
boolean
picture
=
CapturePictureUtils
.
remoteCapturePicture
(
handel
.
getDeviceLoginHandle
(),
0
);
return
picture
;
}
}
}
src/main/java/org/rcisoft/integration/video/common/VideoDeviceHandel.java
0 → 100644
View file @
cc80fa48
package
org
.
rcisoft
.
integration
.
video
.
common
;
import
lombok.Data
;
import
org.rcisoft.integration.video.lib.NetSDKLib
;
/**
* 大华视频监控设备登录状态实体
*/
@Data
public
class
VideoDeviceHandel
{
/**
* 设备登录句柄
*/
private
NetSDKLib
.
LLong
deviceLoginHandle
;
/**
* 登录状态
*/
private
boolean
loginStatus
;
}
src/main/java/org/rcisoft/integration/video/common/VideoDeviceSDKComm.java
0 → 100644
View file @
cc80fa48
package
org
.
rcisoft
.
integration
.
video
.
common
;
import
org.rcisoft.integration.video.config.DaHuaVideoInitConfig
;
/**
* 大华视频监控设备SDK公共服务类
*/
public
class
VideoDeviceSDKComm
{
/**
* 获取接口错误码和错误信息,用于打印
* @return
*/
public
static
String
getErrorCodePrint
()
{
return
"\n{error code: (0x80000000|"
+
(
DaHuaVideoInitConfig
.
netsdk
.
CLIENT_GetLastError
()
&
0x7fffffff
)
+
").参考 NetSDKLib.java }"
+
" - {error info:"
+
ErrorCode
.
getErrorCode
(
DaHuaVideoInitConfig
.
netsdk
.
CLIENT_GetLastError
())
+
"}\n"
;
}
}
src/main/java/org/rcisoft/integration/video/config/CapturePicCallBack.java
0 → 100644
View file @
cc80fa48
package
org
.
rcisoft
.
integration
.
video
.
config
;
import
com.alibaba.fastjson.JSONObject
;
import
com.sun.jna.Pointer
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.integration.video.lib.NetSDKLib
;
import
org.rcisoft.integration.video.utils.SpringBeanUtils
;
import
org.rcisoft.sys.doorreportdata.entity.DoorReportData
;
import
org.rcisoft.sys.doorreportdata.service.DoorReportDataService
;
import
javax.imageio.ImageIO
;
import
java.awt.image.BufferedImage
;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Date
;
@Slf4j
public
class
CapturePicCallBack
implements
NetSDKLib
.
fSnapRev
{
private
String
dataId
;
private
String
savePath
;
private
DoorReportDataService
doorReportDataService
=
SpringBeanUtils
.
getBean
(
DoorReportDataService
.
class
);
public
CapturePicCallBack
(
String
dataId
,
String
savePath
)
{
this
.
dataId
=
dataId
;
this
.
savePath
=
savePath
;
}
/**
* 抓图回调方法
* @param lLoginID
* @param pBuf
* @param RevLen
* @param EncodeType
* @param CmdSerial
* @param dwUser
*/
@Override
public
void
invoke
(
NetSDKLib
.
LLong
lLoginID
,
Pointer
pBuf
,
int
RevLen
,
int
EncodeType
,
int
CmdSerial
,
Pointer
dwUser
)
{
BufferedImage
bufferedImage
=
null
;
if
(
pBuf
!=
null
&&
RevLen
>
0
)
{
// String basePath = "E:\\DAHUAPIC";
// String strFileName =basePath+"\\"+new Date().getTime()+".jpg";
String
strFileName
=
savePath
;
log
.
info
(
"回调函数中的dataId:"
+
dataId
);
DoorReportData
byId
=
doorReportDataService
.
findById
(
1
);
log
.
info
(
JSONObject
.
toJSONString
(
byId
));
System
.
out
.
println
(
"strFileName = "
+
strFileName
);
byte
[]
buf
=
pBuf
.
getByteArray
(
0
,
RevLen
);
ByteArrayInputStream
byteArrInput
=
new
ByteArrayInputStream
(
buf
);
try
{
bufferedImage
=
ImageIO
.
read
(
byteArrInput
);
if
(
bufferedImage
==
null
)
{
return
;
}
ImageIO
.
write
(
bufferedImage
,
"jpg"
,
new
File
(
strFileName
));
}
catch
(
IOException
e
)
{
log
.
error
(
"抓图回调函数出现异常:"
+
e
.
getMessage
(),
e
);
}
}
}
public
String
getDataId
()
{
return
dataId
;
}
public
void
setDataId
(
String
dataId
)
{
this
.
dataId
=
dataId
;
}
public
String
getSavePath
()
{
return
savePath
;
}
public
void
setSavePath
(
String
savePath
)
{
this
.
savePath
=
savePath
;
}
}
src/main/java/org/rcisoft/integration/video/config/DaHuaVideoInitConfig.java
View file @
cc80fa48
...
@@ -2,6 +2,7 @@ package org.rcisoft.integration.video.config;
...
@@ -2,6 +2,7 @@ package org.rcisoft.integration.video.config;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.integration.video.common.VideoDeviceHandel
;
import
org.rcisoft.integration.video.lib.NetSDKLib
;
import
org.rcisoft.integration.video.lib.NetSDKLib
;
import
org.rcisoft.integration.video.lib.NetSDKLib.LLong
;
import
org.rcisoft.integration.video.lib.NetSDKLib.LLong
;
...
@@ -17,7 +18,7 @@ public class DaHuaVideoInitConfig {
...
@@ -17,7 +18,7 @@ public class DaHuaVideoInitConfig {
/**
/**
* 全局视频监控设备登录集合
* 全局视频监控设备登录集合
*/
*/
public
static
ConcurrentHashMap
<
Long
,
LLong
>
videoDeviceMap
=
new
ConcurrentHashMap
();
public
static
ConcurrentHashMap
<
Long
,
VideoDeviceHandel
>
videoDeviceMap
=
new
ConcurrentHashMap
();
/**
/**
* SDK核心
* SDK核心
...
@@ -40,11 +41,6 @@ public class DaHuaVideoInitConfig {
...
@@ -40,11 +41,6 @@ public class DaHuaVideoInitConfig {
*/
*/
private
static
boolean
bLogopen
=
false
;
private
static
boolean
bLogopen
=
false
;
// device disconnect callback instance
private
static
DisConnect
disConnect
=
new
DisConnect
();
// device reconnect callback instance
private
static
HaveReConnect
haveReConnect
=
new
HaveReConnect
();
/**
/**
* 初始化
* 初始化
*/
*/
...
@@ -123,7 +119,10 @@ public class DaHuaVideoInitConfig {
...
@@ -123,7 +119,10 @@ public class DaHuaVideoInitConfig {
}
}
boolean
loginStatus
=
m_hLoginHandle
.
longValue
()
==
0
?
false
:
true
;
boolean
loginStatus
=
m_hLoginHandle
.
longValue
()
==
0
?
false
:
true
;
if
(
loginStatus
){
if
(
loginStatus
){
videoDeviceMap
.
put
(
0L
,
m_hLoginHandle
);
VideoDeviceHandel
handel
=
new
VideoDeviceHandel
();
handel
.
setDeviceLoginHandle
(
m_hLoginHandle
);
handel
.
setLoginStatus
(
true
);
videoDeviceMap
.
put
(
0L
,
handel
);
}
}
return
loginStatus
;
return
loginStatus
;
}
}
...
@@ -151,7 +150,10 @@ public class DaHuaVideoInitConfig {
...
@@ -151,7 +150,10 @@ public class DaHuaVideoInitConfig {
}
}
boolean
loginStatus
=
m_hLoginHandle
.
longValue
()
==
0
?
false
:
true
;
boolean
loginStatus
=
m_hLoginHandle
.
longValue
()
==
0
?
false
:
true
;
if
(
loginStatus
){
if
(
loginStatus
){
videoDeviceMap
.
put
(
deviceId
,
m_hLoginHandle
);
VideoDeviceHandel
handel
=
new
VideoDeviceHandel
();
handel
.
setDeviceLoginHandle
(
m_hLoginHandle
);
handel
.
setLoginStatus
(
true
);
videoDeviceMap
.
put
(
0L
,
handel
);
}
}
return
loginStatus
;
return
loginStatus
;
}
}
...
@@ -162,7 +164,9 @@ public class DaHuaVideoInitConfig {
...
@@ -162,7 +164,9 @@ public class DaHuaVideoInitConfig {
*/
*/
public
static
boolean
logout
()
{
public
static
boolean
logout
()
{
if
(
videoDeviceMap
.
containsKey
(
0L
)){
if
(
videoDeviceMap
.
containsKey
(
0L
)){
LLong
m_hLoginHandle
=
videoDeviceMap
.
get
(
0L
);
VideoDeviceHandel
handel
=
videoDeviceMap
.
get
(
0L
);
if
(
handel
.
getDeviceLoginHandle
()!=
null
&&
handel
.
isLoginStatus
()){
LLong
m_hLoginHandle
=
handel
.
getDeviceLoginHandle
();
if
(
m_hLoginHandle
.
longValue
()
==
0
)
{
if
(
m_hLoginHandle
.
longValue
()
==
0
)
{
return
false
;
return
false
;
}
}
...
@@ -174,6 +178,9 @@ public class DaHuaVideoInitConfig {
...
@@ -174,6 +178,9 @@ public class DaHuaVideoInitConfig {
}
else
{
}
else
{
return
false
;
return
false
;
}
}
}
else
{
return
false
;
}
}
}
}
}
src/main/java/org/rcisoft/integration/video/config/DisConnect.java
View file @
cc80fa48
...
@@ -2,6 +2,7 @@ package org.rcisoft.integration.video.config;
...
@@ -2,6 +2,7 @@ package org.rcisoft.integration.video.config;
import
com.sun.jna.Pointer
;
import
com.sun.jna.Pointer
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.integration.video.common.VideoDeviceHandel
;
import
org.rcisoft.integration.video.lib.NetSDKLib
;
import
org.rcisoft.integration.video.lib.NetSDKLib
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
...
@@ -13,17 +14,24 @@ import java.util.concurrent.ConcurrentHashMap;
...
@@ -13,17 +14,24 @@ import java.util.concurrent.ConcurrentHashMap;
public
class
DisConnect
implements
NetSDKLib
.
fDisConnect
{
public
class
DisConnect
implements
NetSDKLib
.
fDisConnect
{
@Override
@Override
public
void
invoke
(
NetSDKLib
.
LLong
lLoginID
,
String
pchDVRIP
,
int
nDVRPort
,
Pointer
dwUser
)
{
public
void
invoke
(
NetSDKLib
.
LLong
lLoginID
,
String
pchDVRIP
,
int
nDVRPort
,
Pointer
dwUser
)
{
ConcurrentHashMap
<
Long
,
NetSDKLib
.
LLong
>
videoDeviceMap
=
DaHuaVideoInitConfig
.
videoDeviceMap
;
ConcurrentHashMap
<
Long
,
VideoDeviceHandel
>
videoDeviceMap
=
DaHuaVideoInitConfig
.
videoDeviceMap
;
Long
nowDeviceId
=
null
;
Long
nowDeviceId
=
null
;
for
(
Long
deviceId:
videoDeviceMap
.
keySet
()){
for
(
Long
deviceId:
videoDeviceMap
.
keySet
()){
NetSDKLib
.
LLong
lLong
=
videoDeviceMap
.
get
(
deviceId
);
VideoDeviceHandel
handel
=
videoDeviceMap
.
get
(
deviceId
);
if
(
lLong
.
longValue
()
==
lLoginID
.
longValue
()){
if
(!
handel
.
isLoginStatus
()
||
handel
.
getDeviceLoginHandle
()==
null
){
continue
;
}
NetSDKLib
.
LLong
deviceLoginHandle
=
handel
.
getDeviceLoginHandle
();
if
(
deviceLoginHandle
.
longValue
()
==
lLoginID
.
longValue
()){
handel
.
setLoginStatus
(
false
);
nowDeviceId
=
deviceId
;
nowDeviceId
=
deviceId
;
break
;
break
;
}
}
}
}
if
(
nowDeviceId
!=
null
){
if
(
nowDeviceId
!=
null
){
videoDeviceMap
.
remove
(
nowDeviceId
);
VideoDeviceHandel
handel
=
videoDeviceMap
.
get
(
nowDeviceId
);
handel
.
setLoginStatus
(
false
);
videoDeviceMap
.
put
(
nowDeviceId
,
handel
);
}
}
}
}
}
}
src/main/java/org/rcisoft/integration/video/config/HaveReConnect.java
View file @
cc80fa48
...
@@ -2,8 +2,11 @@ package org.rcisoft.integration.video.config;
...
@@ -2,8 +2,11 @@ package org.rcisoft.integration.video.config;
import
com.sun.jna.Pointer
;
import
com.sun.jna.Pointer
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.integration.video.common.VideoDeviceHandel
;
import
org.rcisoft.integration.video.lib.NetSDKLib
;
import
org.rcisoft.integration.video.lib.NetSDKLib
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
/**
*设备连接恢复策略,实现设备连接恢复接口
*设备连接恢复策略,实现设备连接恢复接口
*/
*/
...
@@ -11,6 +14,23 @@ import org.rcisoft.integration.video.lib.NetSDKLib;
...
@@ -11,6 +14,23 @@ import org.rcisoft.integration.video.lib.NetSDKLib;
public
class
HaveReConnect
implements
NetSDKLib
.
fHaveReConnect
{
public
class
HaveReConnect
implements
NetSDKLib
.
fHaveReConnect
{
@Override
@Override
public
void
invoke
(
NetSDKLib
.
LLong
lLoginID
,
String
pchDVRIP
,
int
nDVRPort
,
Pointer
dwUser
)
{
public
void
invoke
(
NetSDKLib
.
LLong
lLoginID
,
String
pchDVRIP
,
int
nDVRPort
,
Pointer
dwUser
)
{
ConcurrentHashMap
<
Long
,
VideoDeviceHandel
>
videoDeviceMap
=
DaHuaVideoInitConfig
.
videoDeviceMap
;
Long
nowDeviceId
=
null
;
for
(
Long
deviceId:
videoDeviceMap
.
keySet
()){
VideoDeviceHandel
handel
=
videoDeviceMap
.
get
(
deviceId
);
if
(
handel
.
isLoginStatus
()){
continue
;
}
NetSDKLib
.
LLong
deviceLoginHandle
=
handel
.
getDeviceLoginHandle
();
if
(
deviceLoginHandle
!=
null
&&
deviceLoginHandle
.
longValue
()
==
lLoginID
.
longValue
()){
handel
.
setLoginStatus
(
true
);
nowDeviceId
=
deviceId
;
}
}
if
(
nowDeviceId
!=
null
){
VideoDeviceHandel
handel
=
videoDeviceMap
.
get
(
nowDeviceId
);
handel
.
setLoginStatus
(
true
);
videoDeviceMap
.
put
(
nowDeviceId
,
handel
);
}
}
}
}
}
src/main/java/org/rcisoft/integration/video/utils/CapturePictureUtils.java
0 → 100644
View file @
cc80fa48
package
org
.
rcisoft
.
integration
.
video
.
utils
;
import
com.sun.jna.Pointer
;
import
com.sun.jna.ptr.IntByReference
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.integration.video.common.VideoDeviceSDKComm
;
import
org.rcisoft.integration.video.config.DaHuaVideoInitConfig
;
import
org.rcisoft.integration.video.lib.NetSDKLib
;
/**
* 抓图工具类
*/
@Slf4j
public
class
CapturePictureUtils
{
/**
* 本地抓图
*/
public
static
boolean
localCapturePicture
(
NetSDKLib
.
LLong
hPlayHandle
,
String
picFileName
)
{
if
(!
DaHuaVideoInitConfig
.
netsdk
.
CLIENT_CapturePictureEx
(
hPlayHandle
,
picFileName
,
NetSDKLib
.
NET_CAPTURE_FORMATS
.
NET_CAPTURE_JPEG
))
{
log
.
error
(
"CLIENT_CapturePicture Failed!:"
+
VideoDeviceSDKComm
.
getErrorCodePrint
());
return
false
;
}
else
{
log
.
debug
(
"CLIENT_CapturePicture success"
);
}
return
true
;
}
/**
* 远程抓图
*/
public
static
boolean
remoteCapturePicture
(
NetSDKLib
.
LLong
m_hLoginHandle
,
int
chn
)
{
return
snapPicture
(
m_hLoginHandle
,
chn
,
0
,
0
);
}
/**
* 定时抓图
*/
public
static
boolean
timerCapturePicture
(
NetSDKLib
.
LLong
m_hLoginHandle
,
int
chn
)
{
return
snapPicture
(
m_hLoginHandle
,
chn
,
1
,
2
);
}
/**
* 停止定时抓图
*/
public
static
boolean
stopCapturePicture
(
NetSDKLib
.
LLong
m_hLoginHandle
,
int
chn
)
{
return
snapPicture
(
m_hLoginHandle
,
chn
,
-
1
,
0
);
}
/**
* 抓图 (除本地抓图外, 其他全部调用此接口)
*/
private
static
boolean
snapPicture
(
NetSDKLib
.
LLong
m_hLoginHandle
,
int
chn
,
int
mode
,
int
interval
)
{
// send caputre picture command to device
NetSDKLib
.
SNAP_PARAMS
stuSnapParams
=
new
NetSDKLib
.
SNAP_PARAMS
();
stuSnapParams
.
Channel
=
chn
;
// channel
stuSnapParams
.
mode
=
mode
;
// capture picture mode
stuSnapParams
.
Quality
=
3
;
// picture quality
stuSnapParams
.
InterSnap
=
interval
;
// timer capture picture time interval
stuSnapParams
.
CmdSerial
=
0
;
// request serial
IntByReference
reserved
=
new
IntByReference
(
0
);
if
(!
DaHuaVideoInitConfig
.
netsdk
.
CLIENT_SnapPictureEx
(
m_hLoginHandle
,
stuSnapParams
,
reserved
))
{
log
.
error
(
"CLIENT_SnapPictureEx Failed!"
+
VideoDeviceSDKComm
.
getErrorCodePrint
());
return
false
;
}
else
{
log
.
debug
(
"CLIENT_SnapPictureEx success"
);
}
return
true
;
}
/**
* 设置抓图回调函数
*/
public
static
void
setSnapRevCallBack
(
NetSDKLib
.
fSnapRev
cbSnapReceive
){
DaHuaVideoInitConfig
.
netsdk
.
CLIENT_SetSnapRevCallBack
(
cbSnapReceive
,
null
);
}
/**
* 设置抓图回调函数
*/
public
static
void
setSnapRevCallBack
(
NetSDKLib
.
fSnapRev
cbSnapReceive
,
Pointer
data
){
DaHuaVideoInitConfig
.
netsdk
.
CLIENT_SetSnapRevCallBack
(
cbSnapReceive
,
data
);
}
}
src/main/java/org/rcisoft/integration/video/utils/SpringBeanUtils.java
0 → 100644
View file @
cc80fa48
package
org
.
rcisoft
.
integration
.
video
.
utils
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
/**
* SpringBean工具
*/
@Component
public
class
SpringBeanUtils
implements
ApplicationContextAware
{
/**
* 上下文对象实例
*/
private
static
ApplicationContext
applicationContext
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
this
.
applicationContext
=
applicationContext
;
}
/**
* 获取applicationContext
*
* @return
*/
public
static
ApplicationContext
getApplicationContext
()
{
return
applicationContext
;
}
/**
* 通过name获取 Bean.
*
* @param name
* @return
*/
public
static
Object
getBean
(
String
name
)
{
return
getApplicationContext
().
getBean
(
name
);
}
/**
* 通过class获取Bean.
*
* @param clazz
* @param <T>
* @return
*/
public
static
<
T
>
T
getBean
(
Class
<
T
>
clazz
)
{
return
getApplicationContext
().
getBean
(
clazz
);
}
/**
* 通过name,以及Clazz返回指定的Bean
*
* @param name
* @param clazz
* @param <T>
* @return
*/
public
static
<
T
>
T
getBean
(
String
name
,
Class
<
T
>
clazz
)
{
return
getApplicationContext
().
getBean
(
name
,
clazz
);
}
}
src/main/java/org/rcisoft/sys/ossinfo/service/OssInfoService.java
View file @
cc80fa48
...
@@ -6,6 +6,7 @@ import org.rcisoft.core.model.CyPersistModel;
...
@@ -6,6 +6,7 @@ import org.rcisoft.core.model.CyPersistModel;
import
org.rcisoft.core.model.CyPageInfo
;
import
org.rcisoft.core.model.CyPageInfo
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -64,4 +65,6 @@ public interface OssInfoService {
...
@@ -64,4 +65,6 @@ public interface OssInfoService {
List
<
OssInfo
>
export
(
OssInfo
ossInfo
);
List
<
OssInfo
>
export
(
OssInfo
ossInfo
);
OssInfo
filePath
(
MultipartFile
file
,
String
temp
);
OssInfo
filePath
(
MultipartFile
file
,
String
temp
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment