actionmanager

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

Documentation

Index

Constants

View Source
const (
	ActionWrite = "WRITE"
	ActionRead  = "READ"
)

Variables

View Source
var GattPeripheral gatt.Peripheral

GattPeripheral represents the remote gatt peripheral device

Functions

func FindCharacteristic

func FindCharacteristic(p gatt.Peripheral, characteristicUUID string) (*gatt.Characteristic, error)

FindCharacteristic is used to find the bluetooth characteristic

func ReadCharacteristic

func ReadCharacteristic(p gatt.Peripheral, c *gatt.Characteristic) ([]byte, error)

ReadCharacteristic is used to read the value of the characteristic

func WriteCharacteristic

func WriteCharacteristic(p gatt.Peripheral, c *gatt.Characteristic, b []byte) error

WriteCharacteristic is used to write some value into the characteristic

Types

type Action

type Action struct {
	// PerformImmediately indicates whether the action is to be performed immediately or not
	PerformImmediately bool `yaml:"perform-immediately" json:"perform-immediately"`
	// Name is the name of the Action
	Name string `yaml:"name" json:"name"`
	// Operation specifies the operation to be performed for this action
	Operation Operation `yaml:"operation" json:"operation"`
}

Action is structure to define a device action

func (*Action) PerformOperation

func (action *Action) PerformOperation(readConverter ...dataconverter.DataRead)

PerformOperation executes the operation

type ActionManager

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

ActionManager is a structure that contains a list of actions

type Operation

type Operation struct {
	// Action can be one of read/write corresponding to get/set respectively
	Action string `yaml:"action" json:"action"`
	// Characteristic refers to the characteristic on which the operation needs to be performed
	CharacteristicUUID string `yaml:"characteristic-uuid" json:"characteristic-uuid"`
	// Value is the value to be written in case of write action and value read from the device in case of read action
	Value []byte `yaml:"value" json:"value"`
}

Operation is structure to define device operation

Jump to

Keyboard shortcuts

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