1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- package isapi
- import (
- "github.com/gin-gonic/gin"
- "github.com/sirupsen/logrus"
- "io/ioutil"
- "lc-fangdaosha/isapi"
- )
- // 越界侦测
- type LineDetectionApi struct {
- }
- // GetLineDetectionCap 获取越界侦测能力
- func (api *LineDetectionApi) GetLineDetectionCap(c *gin.Context) {
- host, err := GetHost(c)
- if err != nil {
- logrus.Errorf("获取host失败:%s", err.Error())
- return
- }
- isapi.TouChuan(host, isapi.GetLineDetectionCap, nil, c)
- }
- // GetSizeLd 获取越界侦测目标的尺寸
- func (api *LineDetectionApi) GetSizeLd(c *gin.Context) {
- host, err := GetHost(c)
- if err != nil {
- logrus.Errorf("获取host失败:%s", err.Error())
- return
- }
- isapi.TouChuan(host, isapi.GetLineDetectionCal, nil, c)
- }
- // PutSizeLd 配置越界侦测目标尺寸
- func (api *LineDetectionApi) PutSizeLd(c *gin.Context) {
- defer c.Request.Body.Close()
- all, err := ioutil.ReadAll(c.Request.Body)
- if err != nil {
- logrus.Errorf("读取数据失败:%e\n", err)
- }
- host, err := GetHost(c)
- if err != nil {
- logrus.Errorf("获取设备连接失败:%e\n", err)
- return
- }
- isapi.TouChuan(host, isapi.PutLineDetectionCal, all, c)
- }
- // GetLineDetection 获取越界侦测能力
- func (api *LineDetectionApi) GetLineDetection(c *gin.Context) {
- host, err := GetHost(c)
- if err != nil {
- logrus.Errorf("获取host失败:%s", err.Error())
- return
- }
- isapi.TouChuan(host, isapi.GetLineDetection, nil, c)
- }
- // PutLineDetection 配置越界侦测能力
- func (api *LineDetectionApi) PutLineDetection(c *gin.Context) {
- defer c.Request.Body.Close()
- all, err := ioutil.ReadAll(c.Request.Body)
- if err != nil {
- logrus.Errorf("读取数据失败:%e\n", err)
- }
- host, err := GetHost(c)
- if err != nil {
- logrus.Errorf("获取设备连接失败:%e\n", err)
- return
- }
- isapi.TouChuan(host, isapi.PutLineDetection, all, c)
- }
|