configuration

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolName string = "BLUETOOTH"
	READWRITE    string = "ReadWrite"
	READ         string = "ReadOnly"
)

Blutooth protocol name

View Source
const (
	BluetoothAdd      string = "Add"
	BluetoothSubtract string = "Subtract"
	BluetoothMultiply string = "Multiply"
	BluetoothDivide   string = "Divide"
)

Bluetooth Protocol Operation type

Variables

View Source
var ConfigFilePath = "configuration/config.yaml"

ConfigFilePath contains the location of the configuration file

View Source
var ConfigMapPath = "/opt/kubeedge/deviceProfile.json"

ConfigMapPath contains the location of the configuration file

Functions

This section is empty.

Types

type Action

type Action struct {
	//PerformImmediately signifies whether the action is to be performed by the action-manager immediately or not
	PerformImmediately bool `yaml:"perform-immediately" json:"perform-immediately"`
	//Name is the name of the Action
	Name string `yaml:"name" json:"name"`
	//PropertyName is the name of the property defined in the device CRD
	PropertyName string `yaml:"device-property-name" json:"device-property-name"`
}

Action is structure to define a device action

type ActionManagerConfig

type ActionManagerConfig struct {
	Actions []Action `yaml:"actions"`
}

ActionManagerConfig is a structure that contains a list of actions

type BLEConfig

type BLEConfig struct {
	Mqtt          Mqtt                        `yaml:"mqtt"`
	Device        Device                      `yaml:"device"`
	Watcher       watcher.Watcher             `yaml:"watcher"`
	Scheduler     scheduler.Scheduler         `yaml:"scheduler"`
	ActionManager actionmanager.ActionManager `yaml:"action-manager"`
	Converter     dataconverter.Converter     `yaml:"data-converter"`
}

BLEConfig is the main structure that stores the configuration information read from both the config file as well as the config map

var Config *BLEConfig

Config is the global configuration used by all the modules of the mapper

func (*BLEConfig) Load

func (b *BLEConfig) Load() error

Load is used to consolidate the information loaded from the configuration file and the configmaps

type BluetoothOperations

type BluetoothOperations struct {
	// Required: Specifies the operation to be performed to convert incoming data
	BluetoothOperationType string `json:"operationType,omitempty"`
	// Required: Specifies with what value the operation is to be performed
	BluetoothOperationValue float64 `json:"operationValue,omitempty"`
}

Specify the operation that should be performed to convert incoming data into understandable form

type BluetoothReadConverter

type BluetoothReadConverter struct {
	// Required: Specifies the start index of the incoming byte stream to be considered to convert the data.
	// For example: start-index:2, end-index:3 concatenates the value present at second and third index of the incoming byte stream. If we want to reverse the order we can give it as start-index:3, end-index:2
	StartIndex int `json:"startIndex,omitempty"`
	// Required: Specifies the end index of incoming byte stream to be considered to convert the data
	// the value specified should be inclusive for example if 3 is specified it includes the third index
	EndIndex int `json:"endIndex,omitempty"`
	// Refers to the number of bits to shift left, if left-shift operation is necessary for conversion
	// +optional
	ShiftLeft uint `json:"shiftLeft,omitempty"`
	// Refers to the number of bits to shift right, if right-shift operation is necessary for conversion
	// +optional
	ShiftRight uint `json:"shiftRight,omitempty"`
	// Specifies in what order the operations(which are required to be performed to convert incoming data into understandable form) are performed
	//+optional
	OrderOfOperations []BluetoothOperations `json:"orderOfOperations,omitempty"`
}

Specifies the operations that may need to be performed to convert the data

type Device

type Device struct {
	ID   string `yaml:"id"`
	Name string `yaml:"name"`
}

Device structure contains the device specific configurations

type DeviceInstance

type DeviceInstance struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	Protocol string `json:"protocol,omitempty"`
	Model    string `json:"model,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"`
	PropertyVisitors []PropertyVisitor `json:"propertyVisitors,omitempty"`
}

DeviceProfile is structure to store in configMap

func (*DeviceProfile) ReadFromConfigMap

func (deviceProfile *DeviceProfile) ReadFromConfigMap() error

ReadFromConfigMap is used to load the information from the configmaps that are provided from the cloud

type Mqtt

type Mqtt struct {
	Mode           int    `yaml:"mode"`
	InternalServer string `yaml:"internal-server"`
	Server         string `yaml:"server"`
}

Mqtt structure contains the MQTT specific configurations

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"`
	Protocol      string      `json:"protocol,omitempty"`
	VisitorConfig interface{} `json:"visitorConfig,omitempty"`
}

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"`
	ProtocolConfig interface{} `json:"protocol_config,omitempty"`
}

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

type ReadConfigFile

type ReadConfigFile struct {
	Mqtt            Mqtt                `yaml:"mqtt"`
	DeviceModelName string              `yaml:"device-model-name"`
	ActionManager   ActionManagerConfig `yaml:"action-manager"`
	Watcher         watcher.Watcher     `yaml:"watcher"`
	Scheduler       scheduler.Scheduler `yaml:"scheduler"`
}

ReadConfigFile is the structure that is used to read the config file to get configuration information from the user

func (*ReadConfigFile) ReadFromConfigFile

func (readConfigFile *ReadConfigFile) ReadFromConfigFile() error

ReadFromConfigFile is used to load the information from the configuration file

type VisitorConfigBluetooth

type VisitorConfigBluetooth struct {
	// Required: Unique ID of the corresponding operation
	CharacteristicUUID string `json:"characteristicUUID,omitempty"`
	// Responsible for converting the data coming from the platform into a form that is understood by the bluetooth device
	// For example: "ON":[1], "OFF":[0]
	//+optional
	DataWriteToBluetooth map[string][]byte `json:"dataWrite,omitempty"`
	// Responsible for converting the data being read from the bluetooth device into a form that is understandable by the platform
	//+optional
	BluetoothDataConverter BluetoothReadConverter `json:"dataConverter,omitempty"`
}

Common visitor configurations for bluetooth protocol

Jump to

Keyboard shortcuts

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