package HikSDK

import (
	"fmt"
	"gitea.com/kunmeng/HikNetSDKPkg/Core"
	"testing"
)

func TestCamera(t *testing.T) {
	err := Core.Init()
	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)
	if err != nil {
		t.Errorf("NewBallCamera() error = %v", err)
		return
	}

	//err = Camera.StartBus(PTZEnum.toHikPTZEnum(PTZEnum.PTZ_RIGHT), 1)
	//if err != nil {
	//	return
	//}
	//time.Sleep(2000 * time.Millisecond)
	//err = Camera.StopBus(PTZEnum.toHikPTZEnum(PTZEnum.PTZ_RIGHT), 1)
	//if err != nil {
	//	return
	//}

	err = Camera.PtzGotoPut(1, 11.11, 22.22, 33.33)
	if err != nil {
		return
	}

	for i := 0; i < 1; i++ {
		ptzdata, err := Camera.GetPTZ()
		if err != nil {
			t.Errorf("GetPTZ() error = %v", err)
			return
		}
		fmt.Printf("%.2f %.2f %.2f \n", ptzdata.P, ptzdata.T, ptzdata.Z)
	}
	err = Camera.Logout()
	if err != nil {
		return
	}
}
