Documentation ¶
Index ¶
- Constants
- func UpdateDeviceModelFieldsFromProto(dev *Device, patch *driverdevice.Device)
- type ACK
- type AddDevice
- type BatchData
- type BatchEvent
- type BatchProperty
- type BatchReport
- type CommonRequest
- type CommonResponse
- type Device
- type Event
- type EventData
- type EventReport
- type InputData
- type OutputData
- type Product
- type Property
- type PropertyData
- type PropertyDesiredDelete
- type PropertyDesiredDeleteResponse
- type PropertyDesiredDeleteValue
- type PropertyDesiredGet
- type PropertyDesiredGetResponse
- type PropertyDesiredGetValue
- type PropertyGet
- type PropertyGetResponse
- type PropertyGetResponseData
- type PropertyReport
- type PropertySet
- type PropertySetResponse
- type PropertySetResponseData
- type Service
- type ServiceDataIn
- type ServiceDataOut
- type ServiceExecuteRequest
- type ServiceExecuteResponse
- type TypeSpec
Constants ¶
View Source
const Version = "1.0"
Variables ¶
This section is empty.
Functions ¶
func UpdateDeviceModelFieldsFromProto ¶
func UpdateDeviceModelFieldsFromProto(dev *Device, patch *driverdevice.Device)
Types ¶
type 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 CommonResponse ¶
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 EventData ¶
type EventData struct { EventCode string `json:"eventCode"` EventTime int64 `json:"eventTime"` OutputParams map[string]interface{} `json:"outputParams"` }
func NewEventData ¶
type EventReport ¶
type EventReport struct { CommonRequest `json:",inline"` Data EventData `json:"data"` }
EventReport 设备向云端上报事件
func NewEventReport ¶
func NewEventReport(needACK bool, data EventData) EventReport
type InputData ¶
func TransformInputData ¶
func TransformInputData(params []*driverproduct.InputParams) []InputData
type OutputData ¶
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 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 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 ServiceDataIn ¶
type ServiceDataOut ¶
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 ¶
func TransformTypeSpecModel ¶
func TransformTypeSpecModel(spec *driverproduct.TypeSpec) TypeSpec
Click to show internal directories.
Click to hide internal directories.