dataconverter

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: 2 Imported by: 0

Documentation

Index

Constants

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

Bluetooth Protocol Operation type

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

type Converter struct {
	DataWrite DataWrite `yaml:"write"`
	DataRead  DataRead  `yaml:"read"`
}

Converter is the structure that contains data conversion specific configuration

type DataMap

type DataMap struct {
	DataMapping map[string][]byte `yaml:"data-map"`
}

DataMap structure contains a mapping between the value that arrives from the platform (expected value) and the byte value to be written into the device

type DataRead

type DataRead struct {
	Actions []ReadAction `yaml:"actions"`
}

dataRead structure contains configuration information specific to data-read

type DataWrite

type DataWrite struct {
	Attributes []WriteAttribute `yaml:"attributes"`
}

dataWrite structure contains configuration information specific to data-writes

type ReadAction

type ReadAction struct {
	ActionName          string        `yaml:"action-name"`
	ConversionOperation ReadOperation `yaml:"conversion-operation"`
}

ReadAction specifies the name of the action along with the conversion operations to be performed in case of data-read

type ReadOperation

type ReadOperation struct {
	StartIndex       int      `yaml:"start-index"`
	EndIndex         int      `yaml:"end-index"`
	ShiftLeft        uint     `yaml:"shift-left"`
	ShiftRight       uint     `yaml:"shift-right"`
	Multiply         float64  `yaml:"multiply"`
	Divide           float64  `yaml:"divide"`
	Add              float64  `yaml:"add"`
	Subtract         float64  `yaml:"subtract"`
	OrderOfExecution []string `yaml:"order-of-execution"`
}

ReadOperation specifies how to convert the data received from the device into meaningful data

func (*ReadOperation) ConvertReadData

func (operation *ReadOperation) ConvertReadData(data []byte) float64

ConvertReadData is the function responsible to convert the data read from the device into meaningful data

type WriteAttribute

type WriteAttribute struct {
	Name       string             `yaml:"name"`
	Operations map[string]DataMap `yaml:"operations"`
}

WriteAttribute structure contains the name of the attribute as well as a data-map of values to be written

Jump to

Keyboard shortcuts

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