models

package
v0.0.0-...-623860c Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoutePrefix = "/beethings/api/v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseUnion

type BaseUnion struct {
	Name string `json:"name,omitempty"`
	Id   string `json:"id,omitempty"`
}

type BoolTypeProperty

type BoolTypeProperty struct {
	Positive int `json:"positive"`
	Negative int `json:"negative"`
}

type CommonResponse

type CommonResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type DataTypeProperty

type DataTypeProperty struct {
	IntType    *IntTypeProperty    `json:"intType,omitempty"`
	FloatType  *FloatTypeProperty  `json:"floatType,omitempty"`
	StringType *StringTypeProperty `json:"stringType,omitempty"`
	BoolType   *BoolTypeProperty   `json:"boolType,omitempty"`
}

type Device

type Device struct {
	// Device Name and Id
	BaseUnion
	// Parent Device Id
	ParentDeviceId string       `json:"parentName,omitempty"`
	DeviceModel    BaseUnion    `json:"deviceModel,omitempty"`
	Status         DeviceStatus `json:"status,omitempty"`
	// Device type
	Type DeviceModelType `json:"type,omitempty"`
	// Longitude and Latitude
	GeoCoordinate GeoCoordinate `json:"geoCoordinate,omitempty"`
	// Last online timestamp
	OnlineTimestamp string `json:"onlineTimestamp,omitempty"`
	// Status update timestamp
	UpdateTimestamp string `json:"updateTimestamp,omitempty"`
	// Property list
	DevicePropertyList DevicePropertyList `json:"devicePropertyList,omitempty"`
	// Alarm list
	DeviceAlarmList DeviceAlarmList `json:"deviceAlarmList,omitempty"`
	// Command list
	DeviceCommandList DeviceCommandList `json:"deviceCommandList,omitempty"`
	Description       string            `json:"description,omitempty"`
}

type DeviceAlarmItem

type DeviceAlarmItem struct {
	BaseUnion
	Current         string                     `json:"current,omitempty"`
	DataType        DeviceModelFeatureDataType `json:"dataType,omitempty"`
	Unit            string                     `json:"unit,omitempty"`
	UpdateTimestamp string                     `json:"updateTimestamp,omitempty"`
}

type DeviceAlarmList

type DeviceAlarmList struct {
	Items []DeviceAlarmItem `json:"items,omitempty"`
}

type DeviceCommandItem

type DeviceCommandItem struct {
	// Name and Id
	BaseUnion
	Synchronized     bool                     `json:"synchronized,omitempty"`
	InputParameter   []DeviceCommandParameter `json:"inputParameter,omitempty"`
	OutputParameter  []DeviceCommandParameter `json:"outputParameter,omitempty"`
	ExecuteTimestamp string                   `json:"executeTimestamp,omitempty"`
	// Command execute status
	Status DeviceCommandStatus `json:"status,omitempty"`
}

type DeviceCommandList

type DeviceCommandList struct {
	Items []DeviceCommandItem `json:"items,omitempty"`
}

type DeviceCommandParameter

type DeviceCommandParameter struct {
	BaseUnion
	DataType DeviceModelFeatureDataType `json:"dataType,omitempty"`
	Unit     string                     `json:"unit,omitempty"`
	Value    string                     `json:"value,omitempty"`
}

type DeviceCommandStatus

type DeviceCommandStatus string
const (
	DeviceCommandStatusExecuting DeviceCommandStatus = "executing"
	DeviceCommandStatusTimeout   DeviceCommandStatus = "timeout"
	DeviceCommandStatusIssue     DeviceCommandStatus = "issue"
	DeviceCommandStatusResponse  DeviceCommandStatus = "response"
	DeviceCommandStatusSuccess   DeviceCommandStatus = "success"
)

type DeviceImport2ExportItem

type DeviceImport2ExportItem struct {
	Device DeviceReq `json:"device,omitempty"`
}

type DeviceImport2ExportList

type DeviceImport2ExportList struct {
	Items []DeviceImport2ExportItem `json:"items,omitempty"`
}

type DeviceImport2ExportListResponse

type DeviceImport2ExportListResponse struct {
	CommonResponse
	List DeviceImport2ExportList `json:"list,omitempty"`
}

type DeviceList

type DeviceList struct {
	Items []Device `json:"items,omitempty"`
}

type DeviceListResponse

type DeviceListResponse struct {
	CommonResponse
	List       DeviceList `json:"list,omitempty"`
	TotalCount int        `json:"totalCount"`
}

type DeviceMetaModel

type DeviceMetaModel struct {
	FeatureId string `gorm:"index:idx_feature_id,unique"`
	DeviceId  string `gorm:"index:idx_feature_id,unique"`
	// Feature type
	Type string
	// Corresponds to command input parameter values
	Current string
	// Corresponds to command output parameter values
	Desired          string
	UpdateTimestamp  string
	ExecuteTimestamp string
	// Command status
	Status string
}

Device meta models

type DeviceModel

type DeviceModel struct {
	BaseUnion
	Type              DeviceModelType `json:"type,omitempty"`
	Price             float64         `json:"price,omitempty"`
	Description       string          `json:"description,omitempty"`
	CreationTimestamp string          `json:"creationTimestamp,omitempty"`
	PicURL            string          `json:"picURL,omitempty"`
	// Device model features
	Features []DeviceModelFeature `json:"features,omitempty"`
	// Device model plugin
	Plugin DeviceModelPlugin `json:"plugin,omitempty"`
}

type DeviceModelCommandFeature

type DeviceModelCommandFeature struct {
	// Command Name and Id
	BaseUnion
	// Synchronized
	Synchronized bool `json:"synchronized,omitempty"`
	// Input parameters
	InputParameter []DeviceModelFeatureParameter `json:"inputParameter,omitempty"`
	// Output parameters
	OutputParameter []DeviceModelFeatureParameter `json:"outputParameter,omitempty"`
	Description     string                        `json:"description,omitempty"`
}

Command

type DeviceModelCommandFeatureInternal

type DeviceModelCommandFeatureInternal struct {
	// Input parameters
	InputParameter []DeviceModelFeatureParameter `json:"inputParameter,omitempty"`
	// Output parameters
	OutputParameter []DeviceModelFeatureParameter `json:"outputParameter,omitempty"`
}

type DeviceModelFeature

type DeviceModelFeature struct {
	Type     DeviceModelFeatureType      `json:"type,omitempty"`
	Property *DeviceModelPropertyFeature `json:"property,omitempty"`
	Alarm    *DeviceModelPropertyFeature `json:"alarm,omitempty"`
	Command  *DeviceModelCommandFeature  `json:"command,omitempty"`
}

type DeviceModelFeatureDataType

type DeviceModelFeatureDataType string
const (
	DeviceModelFeatureDataTypeInt    DeviceModelFeatureDataType = "int"
	DeviceModelFeatureDataTypeFloat  DeviceModelFeatureDataType = "float"
	DeviceModelFeatureDataTypeString DeviceModelFeatureDataType = "string"
	DeviceModelFeatureDataTypeBool   DeviceModelFeatureDataType = "bool"
)

type DeviceModelFeatureItem

type DeviceModelFeatureItem struct {
	// Name and ID
	BaseUnion
	Type      DeviceModelFeatureType     `json:"type,omitempty"`
	DataType  DeviceModelFeatureDataType `json:"dataType,omitempty"`
	Writeable bool                       `json:"writeable,omitempty"`
	Frequency int                        `json:"frequency,omitempty"`
	Unit      string                     `json:"unit,omitempty"`
}

type DeviceModelFeatureList

type DeviceModelFeatureList struct {
	Items []DeviceModelFeatureItem `json:"items,omitempty"`
}

type DeviceModelFeatureListResponse

type DeviceModelFeatureListResponse struct {
	CommonResponse
	List       DeviceModelFeatureList `json:"list,omitempty"`
	TotalCount int                    `json:"totalCount"`
}

type DeviceModelFeatureModel

type DeviceModelFeatureModel struct {
	FeatureId string `gorm:"primaryKey"`
	// Link index constructed by FeatureName and ModelId
	FeatureName  string `gorm:"index:idx_feature_name,unique"`
	ModelId      string `gorm:"index:idx_feature_name,unique"`
	Type         string
	Writeable    bool
	Frequency    int
	Synchronized bool
	Description  string
	// Used for variable parameters
	Parameters string

	DeviceMetaModels []DeviceMetaModel `gorm:"foreignKey:FeatureId;references:FeatureId"`
}

Device model feature table model

type DeviceModelFeatureParameter

type DeviceModelFeatureParameter struct {
	// Name and Id
	BaseUnion
	// Feature data type
	DataType DeviceModelFeatureDataType `json:"dataType,omitempty"`
	// Feature data metas
	DataTypeProperty
}

type DeviceModelFeatureParameterInternal

type DeviceModelFeatureParameterInternal struct {
	// Feature data type
	DataType DeviceModelFeatureDataType `json:"dataType,omitempty"`
	// Feature data metas
	DataTypeProperty
}

type DeviceModelFeatureResponse

type DeviceModelFeatureResponse struct {
	CommonResponse
	Details DeviceModelFeature `json:"details,omitempty"`
}

type DeviceModelFeatureType

type DeviceModelFeatureType string
const (
	DeviceModelFeatureTypeProperty DeviceModelFeatureType = "property"
	DeviceModelFeatureTypeAlarm    DeviceModelFeatureType = "alarm"
	DeviceModelFeatureTypeCommand  DeviceModelFeatureType = "command"
)

type DeviceModelImport2ExportList

type DeviceModelImport2ExportList struct {
	Items []DeviceModel `json:"items,omitempty"`
}

type DeviceModelImport2ExportListResponse

type DeviceModelImport2ExportListResponse struct {
	CommonResponse
	List DeviceModelImport2ExportList `json:"list,omitempty"`
}

type DeviceModelList

type DeviceModelList struct {
	Items []DeviceModel `json:"items,omitempty"`
}

type DeviceModelListResponse

type DeviceModelListResponse struct {
	CommonResponse
	List       DeviceModelList `json:"list,omitempty"`
	TotalCount int             `json:"totalCount"`
}

type DeviceModelModel

type DeviceModelModel struct {
	ModelId           string `gorm:"primaryKey"`
	ModelName         string `gorm:"index"`
	Type              string
	Price             float64
	Description       string
	CreationTimestamp string
	PicURL            string
	// Plugin records
	PluginName            string
	PluginStatus          string
	PluginURL             string
	PluginUploadTimestamp string

	DeviceTableModels        []DeviceTableModel        `gorm:"foreignKey:ModelId;references:ModelId"`
	DeviceModelFeatureModels []DeviceModelFeatureModel `gorm:"foreignKey:ModelId;references:ModelId"`
}

Device model table model

type DeviceModelPlugin

type DeviceModelPlugin struct {
	Name            string                  `json:"name,omitempty"`
	Status          DeviceModelPluginStatus `json:"status,omitempty"`
	UploadTimestamp string                  `json:"uploadTimestamp,omitempty"`
	PluginURL       string                  `json:"pluginURL,omitempty"`
}

type DeviceModelPluginStatus

type DeviceModelPluginStatus string
const (
	DeviceModelPluginStatusNormal   DeviceModelPluginStatus = "normal"
	DeviceModelPluginStatusAbnormal DeviceModelPluginStatus = "abnormal"
)

type DeviceModelPropertyFeature

type DeviceModelPropertyFeature struct {
	// Property parameter
	DeviceModelFeatureParameter
	// Sampling frequency
	Frequency   int    `json:"frequency,omitempty"`
	Writeable   bool   `json:"writeable,omitempty"`
	Description string `json:"description,omitempty"`
}

Property and Alarm

type DeviceModelReq

type DeviceModelReq struct {
	Name        string          `json:"name,omitempty"`
	Type        DeviceModelType `json:"type,omitempty"`
	Price       float64         `json:"price,omitempty"`
	Description string          `json:"description,omitempty"`
}

type DeviceModelResponse

type DeviceModelResponse struct {
	CommonResponse
	Details DeviceModel `json:"details,omitempty"`
}

type DeviceModelType

type DeviceModelType string
const (
	DeviceModelTypeDirectDevice  DeviceModelType = "DirectDevice"
	DeviceModelTypeDirectGateway DeviceModelType = "DirectGateway"
	DeviceModelTypeSubDevice     DeviceModelType = "SubDevice"
	DeviceModelTypeSubGateway    DeviceModelType = "SubGateway"
)

type DevicePropertyItem

type DevicePropertyItem struct {
	BaseUnion
	Desired         string                     `json:"desired,omitempty"`
	Current         string                     `json:"current,omitempty"`
	DataType        DeviceModelFeatureDataType `json:"dataType,omitempty"`
	Unit            string                     `json:"unit,omitempty"`
	Writeable       bool                       `json:"writeable,omitempty"`
	UpdateTimestamp string                     `json:"updateTimestamp,omitempty"`
}

type DevicePropertyList

type DevicePropertyList struct {
	Items []DevicePropertyItem `json:"items,omitempty"`
}

type DeviceReq

type DeviceReq struct {
	Name          string        `json:"name,omitempty"`
	GeoCoordinate GeoCoordinate `json:"geoCoordinate,omitempty"`
	Description   string        `json:"description,omitempty"`
}

type DeviceResponse

type DeviceResponse struct {
	CommonResponse
	Details Device `json:"details,omitempty"`
}

type DeviceStatus

type DeviceStatus string
const (
	DeviceStatusOnline      DeviceStatus = "online"
	DeviceStatusOffline     DeviceStatus = "offline"
	DeviceStatusUnactivated DeviceStatus = "unactivated"
	DeviceStatusAbnormal    DeviceStatus = "abnormal"
)

type DeviceSubDeviceList

type DeviceSubDeviceList struct {
	ModelId  string      `json:"modelId,omitempty"`
	DeviceId string      `json:"deviceId,omitempty"`
	Items    []BaseUnion `json:"items,omitempty"`
}

type DeviceTableModel

type DeviceTableModel struct {
	DeviceId       string `gorm:"primaryKey"`
	DeviceName     string `gorm:"index:idx_device_name,unique"`
	ModelId        string `gorm:"index:idx_device_name,unique"`
	ParentDeviceId string
	Status         string
	// Device type
	Type string
	// Longitude and Latitude
	Longitude float64
	Latitude  float64
	// Last online timestamp
	OnlineTimestamp string
	// Status update timestamp
	UpdateTimestamp   string
	CreationTimestamp string
	Description       string

	DeviceMetaModels []DeviceMetaModel `gorm:"foreignKey:DeviceId;references:DeviceId"`
}

Device table models

type DeviceTopology

type DeviceTopology struct {
	Items []DeviceTopologyItem `json:"items,omitempty"`
}

type DeviceTopologyItem

type DeviceTopologyItem struct {
	BaseUnion
	Type     DeviceModelType `json:"type,omitempty"`
	PicURL   string          `json:"picURLc,omitempty"`
	ParentId string          `json:"parentId,omitempty"`
}

type DeviceTopologyResponse

type DeviceTopologyResponse struct {
	CommonResponse
	Details DeviceTopology `json:"details,omitempty"`
}

type FloatTypeProperty

type FloatTypeProperty struct {
	Min  float64 `json:"min"`
	Max  float64 `json:"max"`
	Step float64 `json:"step"`
	Unit string  `json:"unit,omitempty"`
}

type GeoCoordinate

type GeoCoordinate struct {
	Longitude float64 `json:"longitude,omitempty"`
	Latitude  float64 `json:"latitude,omitempty"`
}

type IntTypeProperty

type IntTypeProperty struct {
	Min  int    `json:"min"`
	Max  int    `json:"max"`
	Step int    `json:"step"`
	Unit string `json:"unit,omitempty"`
}

type StringTypeProperty

type StringTypeProperty struct {
	Len int `json:"len"`
}

Jump to

Keyboard shortcuts

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