device

package
v1.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package device 设备,包括SA状态

Index

Constants

View Source
const (
	AllDevice            listType = iota // 所有设备
	ControlDevice                        // 有可以控制权限的设备(场景的执行任务页面使用)
	ControlAndReadDevice                 // 有可以控制和读的设备(场景的触发条件页面使用)
)

0:所有设备;1:有控制权限的设备

Variables

This section is empty.

Functions

func AddDevice

func AddDevice(c *gin.Context)

AddDevice 用于处理添加设备接口的请求

func BuildInfoDevice

func BuildInfoDevice(device entity.Device, user *session.User, req *http.Request) (iDevice infoDevice, err error)

func CheckSaDevice

func CheckSaDevice(c *gin.Context)

CheckSaDevice 用于处理检查SA设备绑定情况接口的请求

func DelDevice

func DelDevice(c *gin.Context)

DelDevice 用于处理删除设备接口的请求

func InfoDevice

func InfoDevice(c *gin.Context)

InfoDevice 用于处理设备详情接口的请求

func IsAccessAllow

func IsAccessAllow(c *gin.Context)

IsAccessAllow 是否能访问该SA

func ListAllDevice

func ListAllDevice(c *gin.Context)

ListAllDevice 用于处理设备列表接口的请求

func ListLocationDevices

func ListLocationDevices(c *gin.Context)

ListLocationDevices 用于处理房间设备列表接口的请求

func MajorTypeList added in v1.9.1

func MajorTypeList(c *gin.Context)

MajorTypeList 获取主分类

func MinorTypeList added in v1.9.1

func MinorTypeList(c *gin.Context)

MinorTypeList 根据主分类获取次级分类和设备类型

func RegisterDeviceRouter

func RegisterDeviceRouter(r gin.IRouter)

RegisterDeviceRouter 注册与设备相关的路由及其处理函数

func UpdateDevice

func UpdateDevice(c *gin.Context)

UpdateDevice 用于处理修改设备接口的请求

Types

type CheckSaDeviceResp

type CheckSaDeviceResp struct {
	IsBind   bool   `json:"is_bind"`
	Revision string `json:"revision"`
	Version  string `json:"version"`
}

CheckSaDeviceResp 检查SA设备绑定情况接口请求参数

type Device

type Device struct {
	ID              int                    `json:"id"`
	Identity        string                 `json:"identity"`
	Name            string                 `json:"name"`
	LogoURL         string                 `json:"logo_url"`
	PluginID        string                 `json:"plugin_id"`
	LocationID      int                    `json:"location_id,omitempty"`
	LocationName    string                 `json:"location_name,omitempty"`
	IsSA            bool                   `json:"is_sa"`
	Control         string                 `json:"control"` // 控制页相对路径
	PluginURL       string                 `json:"plugin_url"`
	Type            string                 `json:"type"`
	DepartmentID    int                    `json:"department_id,omitempty"`
	DepartmentName  string                 `json:"department_name,omitempty"`
	DeviceInstances plugin.DeviceInstances `json:"device_instances"`
}

Device 设备信息

func WrapDevices

func WrapDevices(c *gin.Context, devices []entity.Device, listType listType) (result []Device, err error)

type IsAccessAllowResp

type IsAccessAllowResp struct {
	AccessAllow bool `json:"access_allow"` // 是否允许访问(判断用户token是否在该SA中有效)
}

type MajorResp added in v1.9.1

type MajorResp struct {
	Types `json:"types"`
}

type MinorReq added in v1.9.1

type MinorReq struct {
	Type plugin.DeviceType `form:"type"`
}

type MinorResp added in v1.9.1

type MinorResp struct {
	Types MinorTypes `json:"types"`
}

type MinorType added in v1.9.1

type MinorType struct {
	Type
	Devices []ModelDevice `json:"devices"`
}

type MinorTypes added in v1.9.1

type MinorTypes []MinorType

func (MinorTypes) Len added in v1.9.1

func (t MinorTypes) Len() int

func (MinorTypes) Less added in v1.9.1

func (t MinorTypes) Less(i, j int) bool

func (MinorTypes) Swap added in v1.9.1

func (t MinorTypes) Swap(i, j int)

type ModelDevice

type ModelDevice struct {
	Name         string `json:"name"`
	Model        string `json:"model"`
	Manufacturer string `json:"manufacturer"`
	Provisioning string `json:"provisioning"` // 配置页地址
	PluginID     string `json:"plugin_id"`
}

type Permissions

type Permissions struct {
	UpdateDevice bool `json:"update_device"`
	DeleteDevice bool `json:"delete_device"`
}

Permissions 设备权限

type Type

type Type struct {
	Name string            `json:"name"`
	Type plugin.DeviceType `json:"type"`
}

type Types added in v1.9.1

type Types []Type

func (Types) Len added in v1.9.1

func (t Types) Len() int

func (Types) Less added in v1.9.1

func (t Types) Less(i, j int) bool

func (Types) Swap added in v1.9.1

func (t Types) Swap(i, j int)

type UpdateDeviceReq

type UpdateDeviceReq struct {
	Name         *string `json:"name"`
	LocationID   int     `json:"location_id"`
	DepartmentID int     `json:"department_id"`
}

UpdateDeviceReq 修改设备接口请求参数

func (*UpdateDeviceReq) Validate

func (req *UpdateDeviceReq) Validate() (updateDevice entity.Device, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL