github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/cloud/pkg/devicecontroller/types/deviceprofile.go (about) 1 package types 2 3 // DeviceProfile is structure to store in configMap. These types would be consumed by mappers to marshal / unmarshal the device profile json 4 type DeviceProfile struct { 5 // DeviceInstances is used to store list of all devices. 6 DeviceInstances []*DeviceInstance `json:"deviceInstances,omitempty"` 7 // DeviceModels is used to store list of all DeviceModels referenced by DeviceInstances 8 DeviceModels []*DeviceModel `json:"deviceModels,omitempty"` 9 // Protocols is list of all protocols used by DeviceInstances 10 Protocols []*Protocol `json:"protocols,omitempty"` 11 // PropertyVisitors is list of all PropertyVisitors in DeviceModels 12 PropertyVisitors []*PropertyVisitor `json:"propertyVisitors,omitempty"` 13 } 14 15 // DeviceInstance is structure to store device in deviceProfile.json in configmap 16 type DeviceInstance struct { 17 // ID is deviceInstance ID 18 ID string `json:"id,omitempty"` 19 // Name is deviceInstance name 20 Name string `json:"name,omitempty"` 21 // Protocol is deviceInstance protocol name. It is generated by deviceController 22 Protocol string `json:"protocol,omitempty"` 23 // Model is deviceInstance model name 24 Model string `json:"model,omitempty"` 25 } 26 27 // DeviceModel is structure to store deviceModel in deviceProfile.json in configmap 28 type DeviceModel struct { 29 // Name is DeviceModel name 30 Name string `json:"name,omitempty"` 31 // Description is DeviceModel description 32 Description string `json:"description,omitempty"` 33 // Properties is list of DeviceModel properties 34 Properties []*Property `json:"properties,omitempty"` 35 } 36 37 // Property is structure to store deviceModel property 38 type Property struct { 39 // Name is Property name 40 Name string `json:"name,omitempty"` 41 // DataType is property dataType 42 DataType string `json:"dataType,omitempty"` 43 // Description is property description 44 Description string `json:"description,omitempty"` 45 // AccessMode is property accessMode 46 AccessMode string `json:"accessMode,omitempty"` 47 // DefaultValue is property defaultValue 48 DefaultValue interface{} `json:"defaultValue,omitempty"` 49 // Minimum is property minimum value in case of int 50 Minimum int64 `json:"minimum,omitempty"` 51 // Maximum is property maximum value in case of int 52 Maximum int64 `json:"maximum,omitempty"` 53 // Unit is unit of measurement 54 Unit string `json:"unit,omitempty"` 55 } 56 57 // Protocol is structure to store protocol in deviceProfile.json in configmap 58 type Protocol struct { 59 // Name is protocol name 60 Name string `json:"name,omitempty"` 61 // Protocol is protocol name defined in deviceInstance. It is generated by deviceController 62 Protocol string `json:"protocol,omitempty"` 63 // ProtocolConfig is protocol config 64 ProtocolConfig interface{} `json:"protocol_config"` 65 } 66 67 // PropertyVisitor is structure to store propertyVisitor in deviceProfile.json in configmap 68 type PropertyVisitor struct { 69 // Name is propertyVisitor name 70 Name string `json:"name,omitempty"` 71 // PropertyName is name of property it is mapped to 72 PropertyName string `json:"propertyName,omitempty"` 73 // ModelName is deviceModel name 74 ModelName string `json:"modelName,omitempty"` 75 // Protocol is protocol of propertyVisitor 76 Protocol string `json:"protocol,omitempty"` 77 // VisitorConfig is property visitor configuration 78 VisitorConfig interface{} `json:"visitorConfig,omitempty"` 79 }