1. NVR 和 BallCamera 添加 Status 功能
This commit is contained in:
parent
a97fc849b8
commit
cefba47e97
@ -432,3 +432,7 @@ func verify(data []byte) (byte, error) {
|
||||
func (this *BallCamera) Logout() error {
|
||||
return Core.Logout(this.userId)
|
||||
}
|
||||
|
||||
func (this *BallCamera) Status() bool {
|
||||
return Core.NET_DVR_RemoteControl(this.userId)
|
||||
}
|
||||
|
||||
@ -12,8 +12,8 @@ func TestCamera(t *testing.T) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
Camera, err := NewBallCamera("192.168.211.48", 8000, "admin", "okwy1234", BuKongQiu)
|
||||
//Camera, err := NewBallCamera("192.168.211.64", 8000, "admin", "ubis3333", Base)
|
||||
//Camera, err := NewBallCamera("192.168.211.48", 8000, "admin", "okwy1234", BuKongQiu)
|
||||
Camera, err := NewBallCamera("192.168.211.64", 8000, "admin", "ubis3333", Base)
|
||||
if err != nil {
|
||||
t.Errorf("NewBallCamera() error = %v", err)
|
||||
return
|
||||
|
||||
@ -58,6 +58,10 @@ func Login(Ip string, Port int, Username string, Password string) (LONG, NET_DVR
|
||||
return LONG(cUserId), DeviceInfo, nil
|
||||
}
|
||||
|
||||
func NET_DVR_RemoteControl(userId LONG) bool {
|
||||
return C.NET_DVR_RemoteControl(C.LONG(userId), C.DWORD(20005), nil, C.DWORD(0)) == C.TRUE
|
||||
}
|
||||
|
||||
func Logout(userId LONG) error {
|
||||
if userId > -1 {
|
||||
cResult := C.NET_DVR_Logout(C.LONG(userId))
|
||||
|
||||
8
Nvr.go
8
Nvr.go
@ -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
|
||||
|
||||
@ -15,7 +15,7 @@ func TestNewNvr(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
diff, err := nvr.getNvrUTCDiff()
|
||||
diff, err := nvr.GetTimeZone()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user