1. BallCamera Status 但对象初始化失败时返回false
This commit is contained in:
@@ -187,6 +187,9 @@ type PTZ struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *BallCamera) GetPTZ() (PTZ, error) {
|
func (this *BallCamera) GetPTZ() (PTZ, error) {
|
||||||
|
if this == nil {
|
||||||
|
return PTZ{}, errors.New("BallCamera is nil")
|
||||||
|
}
|
||||||
if this._type == BuKongQiu {
|
if this._type == BuKongQiu {
|
||||||
var data PTZ
|
var data PTZ
|
||||||
|
|
||||||
@@ -273,6 +276,9 @@ func padding(n int) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *BallCamera) PtzGotoPut(Action int, P, T, Z float64) error {
|
func (this *BallCamera) PtzGotoPut(Action int, P, T, Z float64) error {
|
||||||
|
if this == nil {
|
||||||
|
return errors.New("BallCamera is nil")
|
||||||
|
}
|
||||||
if this._type == BuKongQiu {
|
if this._type == BuKongQiu {
|
||||||
SerialStartHandle, err := Core.SerialStart(this.userId, func(lSerialHandle Core.LONG, lChannel Core.LONG, pRecvDataBuffer []byte, dwBufSize Core.DWORD, pUser unsafe.Pointer) {
|
SerialStartHandle, err := Core.SerialStart(this.userId, func(lSerialHandle Core.LONG, lChannel Core.LONG, pRecvDataBuffer []byte, dwBufSize Core.DWORD, pUser unsafe.Pointer) {
|
||||||
})
|
})
|
||||||
@@ -400,7 +406,9 @@ func (this *BallCamera) retrySend(handle Core.LONG, cmd []byte, maxRetries int,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (receiver *BallCamera) StartBus(direction int, speed int) error {
|
func (receiver *BallCamera) StartBus(direction int, speed int) error {
|
||||||
|
if receiver == nil {
|
||||||
|
return errors.New("BallCamera is nil")
|
||||||
|
}
|
||||||
err := Core.PTZControlWithSpeed_Other(receiver.userId, Core.LONG(receiver.deviceInfo.ByStartChan), Core.DWORD(PTZEnum.toHikPTZEnum(direction)), Core.DWORD(0), Core.DWORD(speed))
|
err := Core.PTZControlWithSpeed_Other(receiver.userId, Core.LONG(receiver.deviceInfo.ByStartChan), Core.DWORD(PTZEnum.toHikPTZEnum(direction)), Core.DWORD(0), Core.DWORD(speed))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -408,6 +416,9 @@ func (receiver *BallCamera) StartBus(direction int, speed int) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (receiver *BallCamera) StopBus(direction int, speed int) error {
|
func (receiver *BallCamera) StopBus(direction int, speed int) error {
|
||||||
|
if receiver == nil {
|
||||||
|
return errors.New("BallCamera is nil")
|
||||||
|
}
|
||||||
err := Core.PTZControlWithSpeed_Other(receiver.userId, Core.LONG(receiver.deviceInfo.ByStartChan), Core.DWORD(PTZEnum.toHikPTZEnum(direction)), Core.DWORD(1), Core.DWORD(speed))
|
err := Core.PTZControlWithSpeed_Other(receiver.userId, Core.LONG(receiver.deviceInfo.ByStartChan), Core.DWORD(PTZEnum.toHikPTZEnum(direction)), Core.DWORD(1), Core.DWORD(speed))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -429,9 +440,15 @@ func verify(data []byte) (byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *BallCamera) Logout() error {
|
func (this *BallCamera) Logout() error {
|
||||||
|
if this == nil {
|
||||||
|
return errors.New("BallCamera is nil")
|
||||||
|
}
|
||||||
return Core.Logout(this.userId)
|
return Core.Logout(this.userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *BallCamera) Status() bool {
|
func (this *BallCamera) Status() bool {
|
||||||
|
if this == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return Core.NET_DVR_RemoteControl(this.userId)
|
return Core.NET_DVR_RemoteControl(this.userId)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user