-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.go
80 lines (72 loc) · 1.65 KB
/
product.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package thingmodel
import "github.com/tuya/tuya-tedge-driver-sdk-go/commons"
type (
// ThingModelProduct 物模型产品定义
ThingModelProduct struct {
Id string
Name string
Description string
Model string
Action []Action
Event []Event
Property []PropertySpec
DeviceLibraryId string
}
// Action 物模型动作定义
Action struct {
AbilityId string
ProductId string
Code string
Name string
Description string
InputParams []InputOutput
OutputParams []InputOutput
Attributes map[string]string // 自定义
}
InputOutput struct {
Code string
Name string
TypeSpec TypeSpec
}
TypeSpec struct {
Properties map[string]PropertySpec
ElementTypeSpec *TypeSpec
Type commons.DataType
Min int64
Max int64
Step int64
Unit string
Scale int64
MaxLen int64
Range []string
Label []string
DefaultValue string
}
// Event 物模型事件定义
Event struct {
AbilityId string
ProductId string
Code string
Name string
Description string
OutputParams []InputOutput
Attributes map[string]string // 自定义
}
// PropertySpec 物模型属性定义
PropertySpec struct {
AbilityId string
ProductId string
Code string
Name string
AccessMode string
TypeSpec TypeSpec
Attributes map[string]string // 自定义
}
// AddProductReq 添加产品
AddProductReq struct {
Id string
Name string
Model string
Description string
}
)