model

package
v0.0.0-...-3da5776 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "1.0"

Variables

This section is empty.

Functions

func UpdateDeviceModelFieldsFromProto

func UpdateDeviceModelFieldsFromProto(dev *Device, patch *driverdevice.Device)

Types

type ACK

type ACK struct {
	Ack int8 `json:"ack"`
}

type AddDevice

type AddDevice struct {
	Name        string
	ProductId   string
	DeviceSn    string
	Description string
	External    map[string]string
}

func NewAddDevice

func NewAddDevice(name, productId, deviceSn, description string, external map[string]string) AddDevice

type BatchData

type BatchData struct {
	Properties map[string]BatchProperty `json:"properties"`
	Events     map[string]BatchEvent    `json:"events"`
}

type BatchEvent

type BatchEvent struct {
	//EventTime    int64                  `json:"eventTime"`
	OutputParams map[string]interface{} `json:"outputParams"`
}

type BatchProperty

type BatchProperty struct {
	Value interface{} `json:"value"`
}

type BatchReport

type BatchReport struct {
	CommonRequest `json:",inline"`
	Data          BatchData `json:"data"`
}

func NewBatchReport

func NewBatchReport(needACK bool, data BatchData) BatchReport

type CommonRequest

type CommonRequest struct {
	Version string `json:"version"`
	MsgId   string `json:"msgId"`
	Time    int64  `json:"time"`
	Sys     ACK    `json:"sys"`
}

type CommonResponse

type CommonResponse struct {
	//RequestId    string
	ErrorMessage string
	Code         string
	Success      bool
}

func NewCommonResponse

func NewCommonResponse(resp *drivercommon.CommonResponse) CommonResponse

type Device

type Device struct {
	Id          string
	Name        string
	ProductId   string
	DeviceSn    string
	Description string
	Status      commons.DeviceStatus
	Platform    commons.IotPlatform
	Secret      string
	External    map[string]string
}

func TransformDeviceModel

func TransformDeviceModel(dev *driverdevice.Device) Device

type Event

type Event struct {
	ProductId   string
	Name        string
	Code        string
	Required    bool
	Type        string
	Description string
	OutputData  []OutputData
}

type EventData

type EventData struct {
	EventCode    string                 `json:"eventCode"`
	EventTime    int64                  `json:"eventTime"`
	OutputParams map[string]interface{} `json:"outputParams"`
}

func NewEventData

func NewEventData(code string, outputParams map[string]interface{}) EventData

type EventReport

type EventReport struct {
	CommonRequest `json:",inline"`
	Data          EventData `json:"data"`
}

EventReport 设备向云端上报事件

func NewEventReport

func NewEventReport(needACK bool, data EventData) EventReport

type InputData

type InputData struct {
	Code     string
	Name     string
	TypeSpec TypeSpec
}

func TransformInputData

func TransformInputData(params []*driverproduct.InputParams) []InputData

type OutputData

type OutputData struct {
	Code     string
	Name     string
	TypeSpec TypeSpec
}

func TransformOutputData

func TransformOutputData(params []*driverproduct.OutputParams) []OutputData

type Product

type Product struct {
	//CreateAt     time.Time
	Id           string
	Name         string
	Key          string
	Description  string
	NodeType     commons.ProductNodeType
	DataFormat   string
	Platform     commons.IotPlatform
	NetType      commons.ProductNetType
	ProtocolType string
	Properties   []Property //属性
	Events       []Event    //事件
	Services     []Service  //服务
}

func TransformProductModel

func TransformProductModel(p *driverproduct.Product) Product

type Property

type Property struct {
	ProductId   string
	Name        string
	Code        string
	Description string
	Required    bool
	AccessMode  string
	TypeSpec    TypeSpec
}

type PropertyData

type PropertyData struct {
	Value interface{} `json:"value"` // 上报的属性值
	Time  int64       `json:"time"`  // 属性变更时间戳
}

func NewPropertyData

func NewPropertyData(value interface{}) PropertyData

type PropertyDesiredDelete

type PropertyDesiredDelete struct {
	CommonRequest `json:",inline"`
	Data          map[string]PropertyDesiredDeleteValue `json:"data"`
}

PropertyDesiredDelete 设备清除属性期望值

type PropertyDesiredDeleteResponse

type PropertyDesiredDeleteResponse struct {
	CommonResponse `json:",inline"`
	Data           map[string]PropertyDesiredGetValue `json:"data"`
}

PropertyDesiredDeleteResponse 设备清除属性期望值响应

type PropertyDesiredDeleteValue

type PropertyDesiredDeleteValue struct {
	Version int64 `json:"version"`
}

type PropertyDesiredGet

type PropertyDesiredGet struct {
	CommonRequest `json:",inline"`
	Data          []string `json:"data"`
}

PropertyDesiredGet 设备拉取属性期望值

type PropertyDesiredGetResponse

type PropertyDesiredGetResponse struct {
	CommonResponse `json:",inline"`
	Data           map[string]PropertyDesiredGetValue `json:"data"`
}

PropertyDesiredGetResponse 设备拉取属性期望值响应

type PropertyDesiredGetValue

type PropertyDesiredGetValue struct {
	Value   interface{} `json:"value"`
	Version int64       `json:"version"`
}

type PropertyGet

type PropertyGet struct {
	CommonRequest `json:",inline"`
	Data          []string            `json:"data"`
	Spec          map[string]Property `json:"-"`
}

PropertyGet 属性查询

type PropertyGetResponse

type PropertyGetResponse struct {
	//CommonResponse `json:",inline"`
	MsgId string                    `json:"msgId"`
	Data  []PropertyGetResponseData `json:"data"`
}

PropertyGetResponse 属性查询设备响应

func NewPropertyGetResponse

func NewPropertyGetResponse(msgId string, data []PropertyGetResponseData) PropertyGetResponse

type PropertyGetResponseData

type PropertyGetResponseData struct {
	Code  string      `json:"code"`
	Value interface{} `json:"value"`
	Time  int64       `json:"time"`
}

type PropertyReport

type PropertyReport struct {
	CommonRequest `json:",inline"`
	Data          map[string]PropertyData `json:"data"`
}

PropertyReport 属性上报 属性查询响应

func NewPropertyReport

func NewPropertyReport(ack bool, data map[string]PropertyData) PropertyReport

type PropertySet

type PropertySet struct {
	CommonRequest `json:",inline"`
	Data          map[string]interface{} `json:"data"`
	Spec          map[string]Property    `json:"-"`
}

PropertySet 属性下发

type PropertySetResponse

type PropertySetResponse struct {
	MsgId string                  `json:"msgId"`
	Data  PropertySetResponseData `json:"data"`
}

func NewPropertySetResponse

func NewPropertySetResponse(msgId string, data PropertySetResponseData) PropertySetResponse

type PropertySetResponseData

type PropertySetResponseData struct {
	ErrorMessage string `json:"errorMessage"`
	Code         uint32 `json:"code"`
	Success      bool   `json:"success"`
}

type Service

type Service struct {
	ProductId   string
	Name        string
	Code        string
	Required    bool
	CallType    string
	Description string
	InputData   []InputData
	OutputData  []OutputData
}

type ServiceDataIn

type ServiceDataIn struct {
	Code        string                 `json:"code"`
	InputParams map[string]interface{} `json:"inputParams"`
}

type ServiceDataOut

type ServiceDataOut struct {
	Code         string                 `json:"code"`
	OutputParams map[string]interface{} `json:"outputParams"`
}

type ServiceExecuteRequest

type ServiceExecuteRequest struct {
	CommonRequest `json:",inline"`
	Data          ServiceDataIn `json:"data"`
	Spec          Service       `json:"-"`
}

type ServiceExecuteResponse

type ServiceExecuteResponse struct {
	MsgId string         `json:"msgId"`
	Data  ServiceDataOut `json:"data"`
}

ServiceExecuteResponse 执行设备动作响应

func NewServiceExecuteResponse

func NewServiceExecuteResponse(msgId string, data ServiceDataOut) ServiceExecuteResponse

type TypeSpec

type TypeSpec struct {
	Type  string
	Specs string
}

func TransformTypeSpecModel

func TransformTypeSpecModel(spec *driverproduct.TypeSpec) TypeSpec

Jump to

Keyboard shortcuts

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