1. NVR 和 BallCamera 添加 Status 功能

This commit is contained in:
kunmeng
2025-04-30 16:48:33 +08:00
parent a97fc849b8
commit cefba47e97
5 changed files with 17 additions and 5 deletions

8
Nvr.go
View File

@@ -28,7 +28,7 @@ func NewNvr(Ip string, Port int, Username, Password string) (*Nvr, error) {
}, nil
}
func (this *Nvr) getNvrUTCDiff() (int, error) {
func (this *Nvr) GetTimeZone() (int, error) {
var data Core.NET_DVR_NETAPPCFG
var dataPtr = unsafe.Pointer(data.GetCPtr())
err := Core.GetDVRConfig(this.userId, 222, 0, dataPtr, Core.DWORD(unsafe.Sizeof(data.GetC())))
@@ -105,7 +105,7 @@ func (this *Nvr) CheckTimeRegionWithDay(Year, Month, Day, Channel uint16) ([]Tim
if err != nil {
return nil, err
}
ByUTCDiff, err := this.getNvrUTCDiff()
ByUTCDiff, err := this.GetTimeZone()
if err != nil {
return nil, err
}
@@ -166,6 +166,10 @@ func (this *Nvr) Logout() error {
return Core.Logout(this.userId)
}
func (this *Nvr) Status() bool {
return Core.NET_DVR_RemoteControl(this.userId)
}
type TimeRange struct {
StartTime time.Time
EndTime time.Time