cloud

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: 19 Imported by: 0

Documentation

Overview

Package cloud 智汀云模块,提供与智汀云对接的功能

Index

Constants

View Source
const (
	DefaultGrpcIdleTime       = 10 * time.Second
	DefaultGrpcPingAckTimeout = 20 * time.Second
)
View Source
const (
	NoSoftwareRecordStatus = 105010
	NoFirmwareRecordStatus = 105008
)

Variables

View Source
var (
	RequestSoftwareLastVersionErr  = fmt.Errorf("request software last version error")
	NoSoftwareLastVersionRecordErr = fmt.Errorf("no software record")

	RequestFirmwareLastVersionErr  = fmt.Errorf("request firmware last version error")
	NoFirmwareLastVersionRecordErr = fmt.Errorf("no firmware record")
)

Functions

func GetBrandsMap added in v1.5.0

func GetBrandsMap() (brandsMap map[string]Brand, err error)

func SaveBrandLogos added in v1.5.0

func SaveBrandLogos()

SaveBrandLogos TODO 保存所有品牌logo

func StartDataTunnel

func StartDataTunnel(ctx context.Context)

Types

type Brand added in v1.5.0

type Brand struct {
	LogoURL      string `json:"logo_url"`
	Name         string `json:"name"`
	PluginAmount int    `json:"plugin_amount"` // 插件数量
}

func GetBrands added in v1.5.0

func GetBrands() (brands []Brand, err error)

type BrandInfo added in v1.5.0

type BrandInfo struct {
	Brand
	Plugins []Plugin `json:"plugins"`
}

func GetBrandInfo added in v1.5.0

func GetBrandInfo(brandName string) (brand BrandInfo, err error)

type ControlStreamClient

type ControlStreamClient struct {
	SaID string
	Key  string

	LogLevel string
	// contains filtered or unexported fields
}

func (*ControlStreamClient) HandleStream

type Device added in v1.5.0

type Device struct {
	Model string     `json:"model" `
	Name  string     `json:"name"`
	Type  DeviceType `json:"type"` // 设备类型

	Control      string `json:"control"`      // 设备控制页面相对路径
	Provisioning string `json:"provisioning"` // 设备置网页面相对路径
}

type DeviceSubType added in v1.5.0

type DeviceSubType string

type DeviceType added in v1.5.0

type DeviceType string
const (
	TypeLight          DeviceType = "light"           // 灯
	TypeSwitch         DeviceType = "switch"          // 开关
	TypeOutlet         DeviceType = "outlet"          // 插座
	TypeRoutingGateway DeviceType = "routing_gateway" // 路由网关
	TypeSecurity       DeviceType = "security"        // 安防
)

type Firmware added in v1.9.1

type Firmware struct {
	Version string `json:"version"`
	URL     string `json:"url"`
	Info    string `json:"info"`
}

func GetLatestFirmware added in v1.9.1

func GetLatestFirmware(pluginID, model string) (firmware Firmware, err error)

GetLatestFirmware 获取最新的固件

type FirmwareLastVersionHttpResult added in v1.9.1

type FirmwareLastVersionHttpResult struct {
	Status int                       `json:"status"`
	Reason string                    `json:"reason"`
	Data   FirmwareLastVersionResult `json:"data"`
}

func GetLastFirmwareVersion added in v1.9.1

func GetLastFirmwareVersion() (result *FirmwareLastVersionHttpResult, err error)

type FirmwareLastVersionResult added in v1.9.1

type FirmwareLastVersionResult struct {
	Name      string `json:"name"`
	Version   string `json:"version"`
	Remark    string `json:"remark"`
	UpdateAt  uint64 `json:"update_at"`
	FileName  string `json:"file_name"`
	FileUrl   string `json:"file_url"`
	Checksum  string `json:"checksum"`
	Algorithm string `json:"algorithm"`
}

type Plugin added in v1.5.0

type Plugin struct {
	ID      int    `json:"id"`
	UID     string `json:"uid"`
	Name    string `json:"name"`
	Image   string `json:"image"`
	Version string `json:"version"`
	Brand   string `json:"brand"`
	Intro   string `json:"intro"`
}

func GetPlugin added in v1.5.0

func GetPlugin(PluginUID string) (plugin Plugin, err error)

func GetPlugins added in v1.5.0

func GetPlugins() (plugins []Plugin, err error)

type SoftwareLastVersionHttpResult added in v1.9.1

type SoftwareLastVersionHttpResult struct {
	Status int                       `json:"status"`
	Reason string                    `json:"reason"`
	Data   SoftwareLastVersionResult `json:"data"`
}

func GetLastSoftwareVersion added in v1.9.1

func GetLastSoftwareVersion() (result *SoftwareLastVersionHttpResult, err error)

type SoftwareLastVersionResult added in v1.9.1

type SoftwareLastVersionResult struct {
	Name     string                                `json:"name"`
	Version  string                                `json:"version"`
	Remark   string                                `json:"remark"`
	UpdateAt uint64                                `json:"update_at"`
	Services []SoftwareLastVersionSubServiceResult `json:"services"`
}

type SoftwareLastVersionSubServiceResult added in v1.9.1

type SoftwareLastVersionSubServiceResult struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Image   string `json:"image"`
}

Jump to

Keyboard shortcuts

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