configmap

package
v1.13.0 Latest Latest
Warning

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

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

Documentation

Overview

Package configmap used to define the configmap structure, and read data from the JSON file and write it to memory

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConnectInfo

func GetConnectInfo(
	devices map[string]*DeviceInstance,
	connectInfo map[string]*ConnectInfo)

GetConnectInfo is a method to generate link information for each device's property

func Parse

func Parse(path string,
	devices map[string]*DeviceInstance,
	dms map[string]*DeviceModel,
	protocols map[string]*Protocol,
	serviceProtocolName string) error

Parse is a method to parse the configmap.

func ParseOdd

func ParseOdd(path string,
	devices map[string]*DeviceInstance,
	dms map[string]*DeviceModel,
	protocols map[string]*Protocol,
	id string) error

ParseOdd is a method to parse the configmap.

Types

type ConnectInfo

type ConnectInfo struct {
	ProtocolCommonConfig []byte
	VisitorConfig        []byte
	ProtocolConfig       []byte
	// contains filtered or unexported fields
}

ConnectInfo the structure of the information to connect device

type Data

type Data struct {
	Properties []DataProperty `json:"dataProperties,omitempty"`
	Topic      string         `json:"dataTopic,omitempty"`
}

Data is data structure for the message that only be subscribed in edge node internal.

type DataMetadata

type DataMetadata struct {
	Timestamp int64  `json:"timestamp"`
	Type      string `json:"type"`
}

DataMetadata data metadata.

type DataProperty

type DataProperty struct {
	Metadatas    DataMetadata `json:"metadata,omitempty"`
	PropertyName string       `json:"propertyName,omitempty"`
	PVisitor     *PropertyVisitor
}

DataProperty is data property.

type DesiredData

type DesiredData struct {
	Value     string   `json:"value,omitempty"`
	Metadatas Metadata `json:"metadata,omitempty"`
}

DesiredData is the desired data.

type DeviceInstance

type DeviceInstance struct {
	ID               string `json:"id,omitempty"`
	Name             string `json:"name,omitempty"`
	ProtocolName     string `json:"protocol,omitempty"`
	PProtocol        Protocol
	Model            string            `json:"model,omitempty"`
	Twins            []Twin            `json:"twins,omitempty"`
	Datas            Data              `json:"data,omitempty"`
	PropertyVisitors []PropertyVisitor `json:"propertyVisitors,omitempty"`
}

DeviceInstance is structure to store device in deviceProfile.json in configmap.

type DeviceModel

type DeviceModel struct {
	Name        string     `json:"name,omitempty"`
	Description string     `json:"description,omitempty"`
	Properties  []Property `json:"properties,omitempty"`
}

DeviceModel is structure to store deviceModel in deviceProfile.json in configmap.

type DeviceProfile

type DeviceProfile struct {
	DeviceInstances []DeviceInstance `json:"deviceInstances,omitempty"`
	DeviceModels    []DeviceModel    `json:"deviceModels,omitempty"`
	Protocols       []Protocol       `json:"protocols,omitempty"`
}

DeviceProfile is structure to store in configMap.

type Metadata

type Metadata struct {
	Timestamp string `json:"timestamp,omitempty"`
	Type      string `json:"type,omitempty"`
}

Metadata is the metadata for data.

type Property

type Property struct {
	Name         string      `json:"name,omitempty"`
	DataType     string      `json:"dataType,omitempty"`
	Description  string      `json:"description,omitempty"`
	AccessMode   string      `json:"accessMode,omitempty"`
	DefaultValue interface{} `json:"defaultValue,omitempty"`
	Minimum      int64       `json:"minimum,omitempty"`
	Maximum      int64       `json:"maximum,omitempty"`
	Unit         string      `json:"unit,omitempty"`
}

Property is structure to store deviceModel property.

type PropertyVisitor

type PropertyVisitor struct {
	Name          string `json:"name,omitempty"`
	PropertyName  string `json:"propertyName,omitempty"`
	ModelName     string `json:"modelName,omitempty"`
	CollectCycle  int64  `json:"collectCycle"`
	ReportCycle   int64  `json:"reportCycle,omitempty"`
	PProperty     Property
	Protocol      string          `json:"protocol,omitempty"`
	VisitorConfig json.RawMessage `json:"visitorConfig"`
}

PropertyVisitor is structure to store propertyVisitor in deviceProfile.json in configmap.

type Protocol

type Protocol struct {
	Name                 string          `json:"name,omitempty"`
	Protocol             string          `json:"protocol,omitempty"`
	ProtocolConfigs      json.RawMessage `json:"protocolConfig,omitempty"`
	ProtocolCommonConfig json.RawMessage `json:"protocolCommonConfig,omitempty"`
}

Protocol is structure to store protocol in deviceProfile.json in configmap.

type ReportedData

type ReportedData struct {
	Value     string   `json:"value,omitempty"`
	Metadatas Metadata `json:"metadata,omitempty"`
}

ReportedData is the reported data.

type Twin

type Twin struct {
	PropertyName string `json:"propertyName,omitempty"`
	PVisitor     *PropertyVisitor
	Desired      DesiredData  `json:"desired,omitempty"`
	Reported     ReportedData `json:"reported,omitempty"`
}

Twin is the set/get pair to one register.

Jump to

Keyboard shortcuts

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