Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d563b72610 | ||
| 41d8da2401 | |||
| 763376a95c | |||
| 8afb72cab6 | |||
| 3e7ead4a2f | |||
| 10f587962f | |||
| 3fd2fc4062 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,6 +3,7 @@
|
||||
/.fleet
|
||||
/cmake-build-debug-visual-studio
|
||||
/cmake-build-release-visual-studio
|
||||
/cmake-build-debug
|
||||
*.lib
|
||||
*.dll
|
||||
*.so
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
FROM alpine:3.19 AS deps
|
||||
FROM r-2.top/alpine:3.19 AS deps
|
||||
|
||||
WORKDIR /usr
|
||||
|
||||
RUN apk add gcc g++ cmake make acl
|
||||
|
||||
FROM alpine:3.19 AS build
|
||||
FROM r-2.top/alpine:3.19 AS build
|
||||
|
||||
WORKDIR /hikbuild
|
||||
|
||||
@@ -14,7 +14,7 @@ COPY . /hikbuild
|
||||
|
||||
RUN cmake . -D Arch=${TARGETARCH} -D CMAKE_BUILD_TYPE=RELEASE && make
|
||||
|
||||
FROM alpine:3.19 AS export
|
||||
FROM r-2.top/alpine:3.19 AS export
|
||||
|
||||
WORKDIR /home
|
||||
COPY --from=build /hikbuild/build /home
|
||||
|
||||
202
Hikvision.go
202
Hikvision.go
@@ -1,202 +0,0 @@
|
||||
package HikNetSDK
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/ebitengine/purego"
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var libc uintptr
|
||||
|
||||
var (
|
||||
DVR_Init func() bool
|
||||
|
||||
newHIKBallCamera func() unsafe.Pointer
|
||||
initBallCamera func(core unsafe.Pointer, ip string, port string, username string, password string, BallMachineType string) bool
|
||||
ptzTo func(core unsafe.Pointer, Action int, P float32, T float32, Z float32) bool
|
||||
ptzGet func(unsafe.Pointer, unsafe.Pointer, unsafe.Pointer, unsafe.Pointer) bool
|
||||
stopBus func(unsafe.Pointer, int) bool
|
||||
startBus func(unsafe.Pointer, int, int) bool
|
||||
|
||||
newHIKNvr func() unsafe.Pointer
|
||||
initNvr func(unsafe.Pointer, string, string, string, string, int) bool
|
||||
checkTimeRegionWithMonth func(core unsafe.Pointer, year int, month int) string
|
||||
checkTimeRegionWithDay func(core unsafe.Pointer, year int, month int, day int) string
|
||||
)
|
||||
|
||||
func init() {
|
||||
var err error
|
||||
libc, err = openLibrary(getSystemLibrary())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
purego.RegisterLibFunc(&DVR_Init, libc, "DVR_Init")
|
||||
|
||||
purego.RegisterLibFunc(&newHIKBallCamera, libc, "NewHIKBallCamera")
|
||||
purego.RegisterLibFunc(&initBallCamera, libc, "InitBallCamera")
|
||||
purego.RegisterLibFunc(&ptzTo, libc, "PtzGotoPut")
|
||||
purego.RegisterLibFunc(&ptzGet, libc, "PtzGet")
|
||||
purego.RegisterLibFunc(&stopBus, libc, "StopBus")
|
||||
purego.RegisterLibFunc(&startBus, libc, "StartBus")
|
||||
|
||||
purego.RegisterLibFunc(&newHIKNvr, libc, "NewHIKNvr")
|
||||
purego.RegisterLibFunc(&initNvr, libc, "InitNvr")
|
||||
purego.RegisterLibFunc(&checkTimeRegionWithMonth, libc, "CheckTimeRegionWithMonth")
|
||||
purego.RegisterLibFunc(&checkTimeRegionWithDay, libc, "CheckTimeRegionWithDay")
|
||||
|
||||
}
|
||||
|
||||
func getSystemLibrary() string {
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
if runtime.GOARCH == "amd64" || runtime.GOARCH == "386" {
|
||||
return "libHikNetSDKPkg_linux_amd64.so"
|
||||
} else {
|
||||
return " libHikNetSDKPkg_linux_arm64.so"
|
||||
}
|
||||
case "windows":
|
||||
return "HikNetSDKPkg_win_amd64.dll"
|
||||
default:
|
||||
panic(fmt.Errorf("GOOS=%s is not supported", runtime.GOOS))
|
||||
}
|
||||
}
|
||||
|
||||
type HIKBallCamera struct {
|
||||
core unsafe.Pointer
|
||||
BallCameraCfg BallCamera
|
||||
}
|
||||
|
||||
func NewHIKBallCamera(BallCameraCfg BallCamera) *HIKBallCamera {
|
||||
return &HIKBallCamera{
|
||||
core: newHIKBallCamera(),
|
||||
BallCameraCfg: BallCameraCfg,
|
||||
}
|
||||
}
|
||||
|
||||
func (h *HIKBallCamera) Login() bool {
|
||||
return initBallCamera(h.core, h.BallCameraCfg.Ip, h.BallCameraCfg.Port, h.BallCameraCfg.User, h.BallCameraCfg.Password, h.BallCameraCfg.Type)
|
||||
}
|
||||
func (h *HIKBallCamera) PtzTo(Action int, P, T, Z float32) bool {
|
||||
return ptzTo(h.core, Action, P, T, Z)
|
||||
}
|
||||
func (h *HIKBallCamera) PTZGet(P, T, Z *float32) bool {
|
||||
return ptzGet(h.core, unsafe.Pointer(P), unsafe.Pointer(T), unsafe.Pointer(Z))
|
||||
}
|
||||
func (h *HIKBallCamera) StopBus(Direction int) bool {
|
||||
return stopBus(h.core, Direction)
|
||||
}
|
||||
func (h *HIKBallCamera) StartBus(Direction, Speed int) bool {
|
||||
return startBus(h.core, Direction, Speed)
|
||||
}
|
||||
|
||||
type HIKNvr struct {
|
||||
core unsafe.Pointer
|
||||
NvrConfig Nvr
|
||||
}
|
||||
|
||||
func NewHIKNvr(nvrConfig Nvr) *HIKNvr {
|
||||
return &HIKNvr{
|
||||
core: newHIKNvr(),
|
||||
NvrConfig: nvrConfig,
|
||||
}
|
||||
}
|
||||
|
||||
func (h *HIKNvr) Login() bool {
|
||||
return initNvr(h.core, h.NvrConfig.Ip, h.NvrConfig.Port, h.NvrConfig.User, h.NvrConfig.Password, h.NvrConfig.Channel)
|
||||
}
|
||||
|
||||
func (h *HIKNvr) CheckTimeRegionWithMonth(year int, month int) string {
|
||||
return checkTimeRegionWithMonth(h.core, year, month)
|
||||
}
|
||||
func (h *HIKNvr) CheckTimeRegionWithDay(year int, month int, day int) string {
|
||||
return checkTimeRegionWithDay(h.core, year, month, day)
|
||||
}
|
||||
|
||||
func (h *HIKBallCamera) WarpingPtByHomography(matrix []float64, p Point) Point {
|
||||
var x, y, z float64
|
||||
x = matrix[0]*p.X + matrix[1]*p.Y + 1.*matrix[2]
|
||||
y = matrix[3]*p.X + matrix[4]*p.Y + 1.*matrix[5]
|
||||
z = matrix[6]*p.X + matrix[7]*p.Y + 1.*matrix[8]
|
||||
|
||||
x /= z
|
||||
y /= z
|
||||
return Point{X: x, Y: y}
|
||||
}
|
||||
|
||||
func (h *HIKBallCamera) mapping(startV float64, max float64, value float64, direction string, method string) float64 {
|
||||
if direction == "+" {
|
||||
if method == "inv" {
|
||||
if value > (max - startV) {
|
||||
return value - (max - startV)
|
||||
} else {
|
||||
return startV + value // 映射
|
||||
}
|
||||
} else {
|
||||
if value > startV {
|
||||
return value - startV
|
||||
} else {
|
||||
return (max - startV) + value // 映射
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if value > startV {
|
||||
return startV + max - value
|
||||
} else {
|
||||
return startV - value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (h *HIKBallCamera) OneClickToSeeInFullView(point Point) bool {
|
||||
TransPoint := h.WarpingPtByHomography(h.BallCameraCfg.Matrix.Matrix, point)
|
||||
return h.PtzTo(5,
|
||||
float32(h.mapping(h.BallCameraCfg.Matrix.PStart, h.BallCameraCfg.Matrix.PMax, TransPoint.X, h.BallCameraCfg.Matrix.PPositiveDirection, "inv")),
|
||||
float32(h.mapping(h.BallCameraCfg.Matrix.TStart, h.BallCameraCfg.Matrix.TMax, TransPoint.Y, h.BallCameraCfg.Matrix.TPositiveDirection, "inv")),
|
||||
0.0,
|
||||
)
|
||||
}
|
||||
|
||||
func (h *HIKBallCamera) PTZ2FullView() (Point, error) {
|
||||
var ptz PTZ
|
||||
if !h.PTZGet(&ptz.P, &ptz.T, &ptz.Z) {
|
||||
return Point{}, fmt.Errorf("PTZ Get Error")
|
||||
}
|
||||
return h.WarpingPtByHomography(h.BallCameraCfg.Matrix.InvMatrix, Point{
|
||||
X: h.mapping(h.BallCameraCfg.Matrix.PStart, h.BallCameraCfg.Matrix.PMax, float64(ptz.P), h.BallCameraCfg.Matrix.PPositiveDirection, ""),
|
||||
Y: h.mapping(h.BallCameraCfg.Matrix.TStart, h.BallCameraCfg.Matrix.TMax, float64(ptz.T), h.BallCameraCfg.Matrix.TPositiveDirection, "")}), nil
|
||||
}
|
||||
|
||||
func (hikBC *HIKBallCamera) Invert3x3() bool {
|
||||
|
||||
a := hikBC.BallCameraCfg.Matrix.Matrix[0]
|
||||
b := hikBC.BallCameraCfg.Matrix.Matrix[1]
|
||||
c := hikBC.BallCameraCfg.Matrix.Matrix[2]
|
||||
d := hikBC.BallCameraCfg.Matrix.Matrix[3]
|
||||
e := hikBC.BallCameraCfg.Matrix.Matrix[4]
|
||||
f := hikBC.BallCameraCfg.Matrix.Matrix[5]
|
||||
g := hikBC.BallCameraCfg.Matrix.Matrix[6]
|
||||
h := hikBC.BallCameraCfg.Matrix.Matrix[7]
|
||||
i := hikBC.BallCameraCfg.Matrix.Matrix[8]
|
||||
|
||||
det := a*(e*i-f*h) - b*(d*i-f*g) + c*(d*h-e*g)
|
||||
|
||||
if det == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
invDet := 1.0 / det
|
||||
hikBC.BallCameraCfg.Matrix.InvMatrix = []float64{
|
||||
(e*i - f*h) * invDet,
|
||||
(c*h - b*i) * invDet,
|
||||
(b*f - c*e) * invDet,
|
||||
(f*g - d*i) * invDet,
|
||||
(a*i - c*g) * invDet,
|
||||
(c*d - a*f) * invDet,
|
||||
(d*h - e*g) * invDet,
|
||||
(b*g - a*h) * invDet,
|
||||
(a*e - b*d) * invDet,
|
||||
}
|
||||
return true
|
||||
}
|
||||
72
Type.go
72
Type.go
@@ -1,72 +0,0 @@
|
||||
package HikNetSDK
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type HikCfg struct {
|
||||
Nvr map[string]Nvr `json:"Nvr"`
|
||||
BallCamera map[string]BallCamera `json:"BallCamera"`
|
||||
}
|
||||
|
||||
type Nvr struct {
|
||||
Name string `json:"Name"`
|
||||
Ip string `json:"Ip"`
|
||||
Port string `json:"Port"`
|
||||
User string `json:"User"`
|
||||
Password string `json:"Password"`
|
||||
Channel int `json:"Channel"`
|
||||
}
|
||||
|
||||
type BallCamera struct {
|
||||
Type string `json:"Type"`
|
||||
Name string `json:"Name"`
|
||||
Ip string `json:"Ip"`
|
||||
Port string `json:"Port"`
|
||||
User string `json:"User"`
|
||||
Password string `json:"Password"`
|
||||
RtspUrl string `json:"RtspUrl"`
|
||||
Matrix Matrix `json:"Matrix"`
|
||||
Channel int `json:"Channel"`
|
||||
}
|
||||
|
||||
type Matrix struct {
|
||||
PStart float64 `json:"P_Start"`
|
||||
PMax float64 `json:"P_Max"`
|
||||
PPositiveDirection string `json:"p_Positive_Direction"`
|
||||
TStart float64 `json:"T_Start"`
|
||||
TMax float64 `json:"T_Max"`
|
||||
TPositiveDirection string `json:"T_Positive_Direction"`
|
||||
Matrix []float64 `json:"Matrix"`
|
||||
InvMatrix []float64 `json:"InvMatrix"`
|
||||
PointSet map[string]PointPair `json:"PointSet"`
|
||||
}
|
||||
|
||||
type PointPair struct {
|
||||
X float64 `json:"X"`
|
||||
Y float64 `json:"Y"`
|
||||
P float64 `json:"P"`
|
||||
T float64 `json:"T"`
|
||||
}
|
||||
|
||||
|
||||
type PTZ struct {
|
||||
P float32 `json:"P"`
|
||||
T float32 `json:"T"`
|
||||
Z float32 `json:"Z"`
|
||||
}
|
||||
|
||||
type MoveCfg struct {
|
||||
Speed int `json:"Speed"`
|
||||
Direction int `json:"Direction"`
|
||||
}
|
||||
type Point struct {
|
||||
X float64 `json:"X"`
|
||||
Y float64 `json:"Y"`
|
||||
}
|
||||
|
||||
func (h *HikCfg) Json() []byte {
|
||||
marshal, err := json.Marshal(h)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return marshal
|
||||
}
|
||||
5
go.mod
5
go.mod
@@ -1,5 +0,0 @@
|
||||
module gitea.com/kunmeng/HikNetSDKPkg
|
||||
|
||||
go 1.23.1
|
||||
|
||||
require github.com/ebitengine/purego v0.8.0
|
||||
2
go.sum
2
go.sum
@@ -1,2 +0,0 @@
|
||||
github.com/ebitengine/purego v0.8.0 h1:JbqvnEzRvPpxhCJzJJ2y0RbiZ8nyjccVUrSM3q+GvvE=
|
||||
github.com/ebitengine/purego v0.8.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
||||
@@ -29,7 +29,7 @@ extern "C" {
|
||||
Omnimatrix bool InitNvr(void* PtrHIKNvr,char* ip, char* port, char* username, char* password, int channel);
|
||||
Omnimatrix char* CheckTimeRegionWithMonth(void* PtrHIKNvr,int year,int month);
|
||||
Omnimatrix char* CheckTimeRegionWithDay(void* PtrHIKNvr,int year,int month,int day);
|
||||
Omnimatrix int NvrUTCDiff();
|
||||
Omnimatrix int NvrUTCDiff(void* PtrHIKNvr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
70
library.cpp
70
library.cpp
@@ -3,50 +3,50 @@
|
||||
#include "src/HIKNvr.h"
|
||||
#include <cstring>
|
||||
|
||||
bool DVR_Init(){
|
||||
bool DVR_Init() {
|
||||
return HK_DVR_Init();
|
||||
}
|
||||
|
||||
void* NewHIKBallCamera() {
|
||||
void *NewHIKBallCamera() {
|
||||
return new HIKBallCamera();
|
||||
}
|
||||
|
||||
bool InitBallCamera(void* PtrHIKBallCamera,const char* ip, const char* port,const char* username,const char* password,const char* BallMachineType){
|
||||
auto* HIKBallCameraObj = (HIKBallCamera*)PtrHIKBallCamera;
|
||||
return HIKBallCameraObj->InitBallCamera(ip,port,username,password,BallMachineType);
|
||||
bool InitBallCamera(void *PtrHIKBallCamera, const char *ip, const char *port, const char *username, const char *password, const char *BallMachineType) {
|
||||
auto *HIKBallCameraObj = (HIKBallCamera *)PtrHIKBallCamera;
|
||||
return HIKBallCameraObj->InitBallCamera(ip, port, username, password, BallMachineType);
|
||||
}
|
||||
|
||||
bool PtzGotoPut(void* PtrHIKBallCamera,int Action, float P, float T, float Z){
|
||||
auto* HIKBallCameraObj = (HIKBallCamera*)PtrHIKBallCamera;
|
||||
return HIKBallCameraObj->PtzGotoPut(Action,P,T,Z);
|
||||
bool PtzGotoPut(void *PtrHIKBallCamera, int Action, float P, float T, float Z) {
|
||||
auto *HIKBallCameraObj = (HIKBallCamera *)PtrHIKBallCamera;
|
||||
return HIKBallCameraObj->PtzGotoPut(Action, P, T, Z);
|
||||
}
|
||||
|
||||
bool PtzGet(void* PtrHIKBallCamera,void *P, void *T, void *Z){
|
||||
auto* HIKBallCameraObj = (HIKBallCamera*)PtrHIKBallCamera;
|
||||
return HIKBallCameraObj->PtzGet((float*)P,(float*)T,(float*)Z);
|
||||
bool PtzGet(void *PtrHIKBallCamera, void *P, void *T, void *Z) {
|
||||
auto *HIKBallCameraObj = (HIKBallCamera *)PtrHIKBallCamera;
|
||||
return HIKBallCameraObj->PtzGet((float *)P, (float *)T, (float *)Z);
|
||||
}
|
||||
|
||||
bool StopBus(void* PtrHIKBallCamera,int direction){
|
||||
auto* HIKBallCameraObj = (HIKBallCamera*)PtrHIKBallCamera;
|
||||
bool StopBus(void *PtrHIKBallCamera, int direction) {
|
||||
auto *HIKBallCameraObj = (HIKBallCamera *)PtrHIKBallCamera;
|
||||
return HIKBallCameraObj->StopBus(direction);
|
||||
}
|
||||
|
||||
bool StartBus(void* PtrHIKBallCamera,int direction,int speed){
|
||||
auto* HIKBallCameraObj = (HIKBallCamera*)PtrHIKBallCamera;
|
||||
return HIKBallCameraObj->StartBus(direction,speed);
|
||||
bool StartBus(void *PtrHIKBallCamera, int direction, int speed) {
|
||||
auto *HIKBallCameraObj = (HIKBallCamera *)PtrHIKBallCamera;
|
||||
return HIKBallCameraObj->StartBus(direction, speed);
|
||||
}
|
||||
|
||||
void* NewHIKNvr(){
|
||||
void *NewHIKNvr() {
|
||||
return new HIKNvr();
|
||||
}
|
||||
|
||||
bool InitNvr(void* PtrHIKNvr,char* ip, char* port, char* username, char* password, int channel){
|
||||
auto* HIKNvrObj = (HIKNvr*)PtrHIKNvr;
|
||||
return HIKNvrObj->InitNvr(ip,port,username,password,channel);
|
||||
bool InitNvr(void *PtrHIKNvr, char *ip, char *port, char *username, char *password, int channel) {
|
||||
auto *HIKNvrObj = (HIKNvr *)PtrHIKNvr;
|
||||
return HIKNvrObj->InitNvr(ip, port, username, password, channel);
|
||||
}
|
||||
|
||||
char* CheckTimeRegionWithMonth(void* PtrHIKNvr,int year,int month){
|
||||
auto* HIKNvrObj = (HIKNvr*)PtrHIKNvr;
|
||||
char *CheckTimeRegionWithMonth(void *PtrHIKNvr, int year, int month) {
|
||||
auto *HIKNvrObj = (HIKNvr *)PtrHIKNvr;
|
||||
|
||||
DateTime select_time;
|
||||
select_time.year() = year;
|
||||
@@ -58,17 +58,18 @@ char* CheckTimeRegionWithMonth(void* PtrHIKNvr,int year,int month){
|
||||
std::vector<int> available_date_vec;
|
||||
nRet = HIKNvrObj->CheckTimeRegionWithMonth(select_time, available_date_vec);
|
||||
|
||||
if (nRet == 0)
|
||||
{
|
||||
if (nRet == 0) {
|
||||
res = HIKNvrObj->TimeToJson(select_time, &available_date_vec).dump();
|
||||
}else{
|
||||
res = "";
|
||||
}
|
||||
char* cString = new char[res.size() + 1];
|
||||
std::strcpy(cString,res.c_str());
|
||||
char *cString = new char[res.size() + 1];
|
||||
std::strcpy(cString, res.c_str());
|
||||
return cString;
|
||||
}
|
||||
|
||||
char* CheckTimeRegionWithDay(void* PtrHIKNvr,int year,int month,int day){
|
||||
auto* HIKNvrObj = (HIKNvr*)PtrHIKNvr;
|
||||
char *CheckTimeRegionWithDay(void *PtrHIKNvr, int year, int month, int day) {
|
||||
auto *HIKNvrObj = (HIKNvr *)PtrHIKNvr;
|
||||
DateTime select_time;
|
||||
select_time.year() = year;
|
||||
select_time.month() = month;
|
||||
@@ -76,16 +77,17 @@ char* CheckTimeRegionWithDay(void* PtrHIKNvr,int year,int month,int day){
|
||||
std::string res;
|
||||
std::vector<TimeRecord> available_time_vec;
|
||||
int nRet = HIKNvrObj->CheckTimeRegionWithDay(select_time, available_time_vec);
|
||||
if (nRet == 0)
|
||||
{
|
||||
if (nRet == 0) {
|
||||
res = HIKNvrObj->TimeToJsonInDay(select_time, &available_time_vec).dump();
|
||||
}else{
|
||||
res = "";
|
||||
}
|
||||
char* cString = new char[res.size() + 1];
|
||||
std::strcpy(cString,res.c_str());
|
||||
char *cString = new char[res.size() + 1];
|
||||
std::strcpy(cString, res.c_str());
|
||||
return cString;
|
||||
}
|
||||
|
||||
int NvrUTCDiff(void* PtrHIKNvr){
|
||||
auto* HIKNvrObj = (HIKNvr*)PtrHIKNvr;
|
||||
int NvrUTCDiff(void *PtrHIKNvr) {
|
||||
auto *HIKNvrObj = (HIKNvr *)PtrHIKNvr;
|
||||
return HIKNvrObj->GetNvrUTCDiff();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-FileCopyrightText: 2023 The Ebitengine Authors
|
||||
|
||||
//go:build darwin || freebsd || linux
|
||||
|
||||
package HikNetSDK
|
||||
|
||||
import "github.com/ebitengine/purego"
|
||||
|
||||
func openLibrary(name string) (uintptr, error) {
|
||||
return purego.Dlopen(name, purego.RTLD_NOW|purego.RTLD_GLOBAL)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-FileCopyrightText: 2023 The Ebitengine Authors
|
||||
|
||||
package HikNetSDK
|
||||
|
||||
import "syscall"
|
||||
|
||||
func openLibrary(name string) (uintptr, error) {
|
||||
// Use [syscall.LoadLibrary] here to avoid external dependencies (#270).
|
||||
// For actual use cases, [golang.org/x/sys/windows.NewLazySystemDLL] is recommended.
|
||||
handle, err := syscall.LoadLibrary(name)
|
||||
return uintptr(handle), err
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "HIKBallCamera.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "FormatTrans.h"
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
@@ -30,7 +30,9 @@ bool HIKNvr::InitNvr(std::string ip, std::string port, std::string username, std
|
||||
int HIKNvr::GetNvrUTCDiff(){
|
||||
NET_DVR_NETAPPCFG struNAC = {0};
|
||||
DWORD ZoneSize = 0;
|
||||
NET_DVR_GetDVRConfig(LoginID, NET_DVR_GET_NETAPPCFG, 0, &struNAC, sizeof(NET_DVR_NETAPPCFG), &ZoneSize);
|
||||
if (NET_DVR_GetDVRConfig(LoginID, NET_DVR_GET_NETAPPCFG, 0, &struNAC, sizeof(NET_DVR_NETAPPCFG), &ZoneSize)){
|
||||
return 5000;
|
||||
};
|
||||
int nDiffHour = struNAC.struNtpClientParam.cTimeDifferenceH;
|
||||
int nDiffMin = struNAC.struNtpClientParam.cTimeDifferenceM;
|
||||
nDiffTotalMin = (nDiffHour < 0 ? -1 : 1) * (abs(nDiffHour) * 60 + nDiffMin);
|
||||
|
||||
Reference in New Issue
Block a user