isapi_event_httphost.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package isapi
  2. import (
  3. "encoding/xml"
  4. "github.com/sirupsen/logrus"
  5. )
  6. type eventType string
  7. const (
  8. shelterAlarm eventType = "shelteralarm" //遮盖报警
  9. fieldAlarm eventType = "fielddetection" //区域入侵
  10. lineAlarm eventType = "linedetection" //越界侦测
  11. regionEntrance eventType = "regionEntrance" //进入区域侦测
  12. regionExiting eventType = "regionExiting" //离开区域侦测
  13. )
  14. //todo 边缘端启动时配置一次, 提供主动配置配置接口
  15. // GetHostCap 获取监听主机参数能力
  16. func (c *Client) GetHostCap() ([]byte, error) {
  17. return c.CommonGet("/ISAPI/Event/notification/httpHosts/capabilities")
  18. }
  19. // PutHost 配置单个监听主机参数
  20. func (c *Client) PutHost(data []byte) (info ResponseStatus, err error) {
  21. resp, err := c.CommonPut(data, "/ISAPI/Event/notification/httpHosts")
  22. if err != nil {
  23. logrus.Error("请求出错", err)
  24. return
  25. }
  26. err = xml.Unmarshal(resp, &info)
  27. return
  28. }
  29. // DelHost 删除单个监听主机参数
  30. func (c *Client) DelHost() ([]byte, error) {
  31. return c.CommonDel(nil, "/ISAPI/Event/notification/httpHosts/1")
  32. }
  33. // GetHost 获取单个监听主机参数
  34. func (c *Client) GetHost() ([]byte, error) {
  35. return c.CommonGet("/ISAPI/Event/notification/httpHosts/1")
  36. }