isapi_event_tamperDetection.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package isapi
  2. import (
  3. "net/url"
  4. )
  5. type RegionCoordinates struct {
  6. PositionX string `xml:"positionX"`
  7. PositionY string `xml:"positionY"`
  8. }
  9. // TamperDetectionRegionList 配置指定通道视频遮盖所有区域参数
  10. type TamperDetectionRegionList struct {
  11. TamperDetectionRegion []struct {
  12. ID string `xml:"id"`
  13. Enabled bool `xml:"enabled"`
  14. SensitivityLevel int `xml:"sensitivityLevel"`
  15. RegionCoordinatesList struct {
  16. RegionCoordinates []RegionCoordinates `xml:"RegionCoordinates"`
  17. } `xml:"RegionCoordinatesList"`
  18. } `xml:"TamperDetectionRegion"`
  19. }
  20. // TamperDetection 获取指定通道视频遮盖参数
  21. type TamperDetection struct {
  22. Enabled string `xml:"enabled"`
  23. NormalizedScreenSize struct {
  24. NormalizedScreenWidth string `xml:"normalizedScreenWidth"`
  25. NormalizedScreenHeight string `xml:"normalizedScreenHeight"`
  26. } `xml:"normalizedScreenSize"`
  27. TampersensitivityLevel string `xml:"tampersensitivityLevel"`
  28. TamperDetectionRegionList TamperDetectionRegionList
  29. }
  30. // GetTamperDetection 获取指定通道视频遮盖参数
  31. func (c *Client) GetTamperDetection() ([]byte, error) {
  32. return c.CommonGet("/ISAPI/System/Video/inputs/channels/1/tamperDetection")
  33. }
  34. // PutTamperDetection 配置指定通道视频遮盖参数
  35. func (c *Client) PutTamperDetection(data []byte) (resp []byte, err error) {
  36. return c.CommonPut(data, "/ISAPI/System/Video/inputs/channels/1/tamperDetection")
  37. }
  38. // DelTamperDetection 清除指定通道视频遮盖参数
  39. func (c *Client) DelTamperDetection() (resp []byte, err error) {
  40. u, err := url.Parse(c.BaseURL + "/ISAPI/System/Video/inputs/channels1/tamperDetection/regions")
  41. if err != nil {
  42. return nil, err
  43. }
  44. var data = TamperDetection{}
  45. data.TamperDetectionRegionList.TamperDetectionRegion = nil
  46. resp, err = c.DeleteXML(u, nil)
  47. if err != nil {
  48. return nil, err
  49. }
  50. return resp, nil
  51. }