Type.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package HikNetSDK
  2. import "encoding/json"
  3. type HikCfg struct {
  4. Nvr []Nvr `json:"Nvr"`
  5. BallCamera []BallCamera `json:"BallCamera"`
  6. }
  7. type Nvr struct {
  8. Name string `json:"name"`
  9. Ip string `json:"ip"`
  10. Port string `json:"port"`
  11. User string `json:"user"`
  12. Password string `json:"Password"`
  13. Channel int `json:"Channel"`
  14. }
  15. type BallCamera struct {
  16. Type string `json:"Type"`
  17. Name string `json:"name"`
  18. Ip string `json:"ip"`
  19. Port string `json:"port"`
  20. User string `json:"user"`
  21. Password string `json:"Password"`
  22. RtspUrl string `json:"RtspUrl"`
  23. Matrix Matrix `json:"Matrix"`
  24. Channel int `json:"Channel"`
  25. }
  26. type Matrix struct {
  27. PStart float64 `json:"P_Start"`
  28. PMax float64 `json:"P_Max"`
  29. PPositiveDirection string `json:"p_Positive_Direction"`
  30. TStart float64 `json:"T_Start"`
  31. TMax float64 `json:"T_Max"`
  32. TPositiveDirection string `json:"T_Positive_Direction"`
  33. Matrix []float64 `json:"Matrix"`
  34. InvMatrix []float64 `json:"InvMatrix"`
  35. }
  36. type PTZ struct {
  37. P float32 `json:"P"`
  38. T float32 `json:"T"`
  39. Z float32 `json:"Z"`
  40. }
  41. type MoveCfg struct {
  42. Speed int `json:"Speed"`
  43. Direction int `json:"Direction"`
  44. }
  45. type Point struct {
  46. X float64 `json:"x"`
  47. Y float64 `json:"y"`
  48. }
  49. func (h *HikCfg) Json() []byte {
  50. marshal, err := json.Marshal(h)
  51. if err != nil {
  52. return nil
  53. }
  54. return marshal
  55. }
  56. func (h *HikCfg) GetBallCameraByName(name string) *BallCamera {
  57. for i, camera := range h.BallCamera {
  58. if camera.Name == name {
  59. return &h.BallCamera[i]
  60. }
  61. }
  62. return nil
  63. }