ble

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

README

BLE Plugin

Documentation

Documentation

Index

Constants

View Source
const (
	// Name ...
	Name = "ble"
	// FuncEntityAction ...
	FuncEntityAction = "entityAction"

	Version = "0.0.1"

	AttrAddress              = "address"
	AttrCharacteristic       = "characteristic"
	AttrService              = "service"
	AttrTimeoutSec           = "timeout_sec"
	AttrConnectionTimeoutSec = "connection_timeout_sec"
	AttrDebug                = "debug"
	ActionScan               = "SCAN"
	AttrSystemInfo           = "SystemInfo"

	FunctionName = "automationTriggerBle"
)

Variables

Functions

func GetDisconnectBind

func GetDisconnectBind(actor *Actor) func() Response

func GetReadBind

func GetReadBind(actor *Actor) func(char string) Response

func GetSubscribeBind

func GetSubscribeBind(actor *Actor) func(char string, handler func([]byte)) Response

func GetWriteBind

func GetWriteBind(actor *Actor) func(char string, payload []byte, withResponse bool) Response

func New

func New() supervisor.Pluggable

New ...

func NewActions

func NewActions() map[string]supervisor.ActorAction

func NewSettings

func NewSettings() map[string]*m.Attribute

NewSettings ...

func NewTriggerParams

func NewTriggerParams() m.TriggerParams

Types

type Actor

type Actor struct {
	*supervisor.BaseActor
	// contains filtered or unexported fields
}

Actor ...

func NewActor

func NewActor(entity *m.Entity,
	service supervisor.Service) (actor *Actor)

NewActor ...

func (*Actor) Destroy

func (e *Actor) Destroy()

func (*Actor) SetState

func (e *Actor) SetState(params supervisor.EntityStateParams) error

SetState ...

func (*Actor) Spawn

func (e *Actor) Spawn()

type Ble

type Ble struct {
	// contains filtered or unexported fields
}

func NewBle

func NewBle(address string, timeout, connectionTimeout int64, debug bool) *Ble

func (*Ble) Connect

func (b *Ble) Connect() (*bluetooth.Device, error)

func (*Ble) Disconnect

func (b *Ble) Disconnect() error

func (*Ble) GetCharacteristics

func (b *Ble) GetCharacteristics(chars []bluetooth.UUID) ([]bluetooth.DeviceCharacteristic, error)

func (*Ble) GetServices

func (b *Ble) GetServices() ([]bluetooth.DeviceService, error)

func (*Ble) Read

func (b *Ble) Read(char bluetooth.UUID) ([]byte, error)

func (*Ble) Scan

func (b *Ble) Scan(address *bluetooth.UUID)

func (*Ble) Subscribe

func (b *Ble) Subscribe(char bluetooth.UUID, handler func([]byte)) error

func (*Ble) Write

func (b *Ble) Write(char bluetooth.UUID, request []byte, withResponse bool) ([]byte, error)

type Cache

type Cache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

type Response

type Response struct {
	Response []byte `json:"response"`
	Error    string `json:"error"`
}

type Trigger

type Trigger struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewTrigger

func NewTrigger(eventBus bus.Bus) *Trigger

func (*Trigger) AsyncAttach

func (t *Trigger) AsyncAttach(wg *sync.WaitGroup)

func (*Trigger) Connect

func (t *Trigger) Connect(params *TriggerParams, firstTime bool) error

func (*Trigger) FunctionName

func (t *Trigger) FunctionName() string

FunctionName ...

func (*Trigger) Name

func (t *Trigger) Name() string

func (*Trigger) Shutdown

func (t *Trigger) Shutdown()

func (*Trigger) Subscribe

func (t *Trigger) Subscribe(options triggers.Subscriber) error

Subscribe ...

func (*Trigger) Unsubscribe

func (t *Trigger) Unsubscribe(options triggers.Subscriber) error

Unsubscribe ...

type TriggerParams

type TriggerParams struct {
	*Ble
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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