Documentation
¶
Overview ¶
Package device 设备,包括SA状态
Index ¶
- Constants
- func AddDevice(c *gin.Context)
- func BuildInfoDevice(device entity.Device, user *session.User, req *http.Request) (iDevice infoDevice, err error)
- func CheckSaDevice(c *gin.Context)
- func ControlPermissions(d entity.Device) ([]types.Permission, error)
- func DelDevice(c *gin.Context)
- func DeviceManagePermissions(d entity.Device) []types.Permission
- func DevicePermissions(d entity.Device) (ps []types.Permission, err error)
- func InfoDevice(c *gin.Context)
- func IsAccessAllow(c *gin.Context)
- func IsDeviceControlPermit(areaID uint64, userID int, pluginID, identity string, data json.RawMessage) bool
- func ListAllDevice(c *gin.Context)
- func ListLocationDevices(c *gin.Context)
- func RegisterDeviceRouter(r gin.IRouter)
- func TypeList(c *gin.Context)
- func UpdateDevice(c *gin.Context)
- type CheckSaDeviceResp
- type Device
- type IsAccessAllowResp
- type ModelDevice
- type Permissions
- type Response
- type Type
- type UpdateDeviceReq
Constants ¶
View Source
const ( AllDevice listType = iota // 所有设备 ControlDevice // 有控制权限的设备 )
0:所有设备;1:有控制权限的设备
Variables ¶
This section is empty.
Functions ¶
func BuildInfoDevice ¶
func ControlPermissions ¶
func ControlPermissions(d entity.Device) ([]types.Permission, error)
ControlPermissions 根据配置获取设备所有控制权限
func DeviceManagePermissions ¶
func DeviceManagePermissions(d entity.Device) []types.Permission
DeviceManagePermissions 设备的管理权限,暂时只有固件升级
func DevicePermissions ¶
func DevicePermissions(d entity.Device) (ps []types.Permission, err error)
DevicePermissions 根据配置获取设备所有权限
func IsDeviceControlPermit ¶
func IsDeviceControlPermit(areaID uint64, userID int, pluginID, identity string, data json.RawMessage) bool
IsDeviceControlPermit 控制设备的websocket命令 是否有权限
func ListLocationDevices ¶
ListLocationDevices 用于处理房间设备列表接口的请求
func RegisterDeviceRouter ¶
RegisterDeviceRouter 注册与设备相关的路由及其处理函数
Types ¶
type CheckSaDeviceResp ¶
CheckSaDeviceResp 检查SA设备绑定情况接口请求参数
type Device ¶
type Device struct {
ID int `json:"id"`
Identity string `json:"identity"`
Name string `json:"name"`
Logo string `json:"logo"` // logo相对路径
LogoURL string `json:"logo_url"`
PluginID string `json:"plugin_id"`
LocationID int `json:"location_id"`
LocationName string `json:"location_name"`
IsSA bool `json:"is_sa"`
Control string `json:"control"` // 控制页相对路径
PluginURL string `json:"plugin_url"`
Type string `json:"type"`
}
Device 设备信息
type IsAccessAllowResp ¶
type IsAccessAllowResp struct {
AccessAllow bool `json:"access_allow"` // 是否允许访问(判断用户token是否在该SA中有效)
}
type ModelDevice ¶
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"`
Devices []ModelDevice `json:"devices"`
}
type UpdateDeviceReq ¶
UpdateDeviceReq 修改设备接口请求参数
Click to show internal directories.
Click to hide internal directories.