golaunch

package module
v0.0.0-...-661fe46 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: BSD-3-Clause Imports: 8 Imported by: 5

README

Golaunch

GoDoc Go Report Card

Golaunch is a BLE central for controlling a Launch. It's build using currantlabs(/paypal's) gatt implementation.

Setup

See the gatt docs for the Bluetooth requirements/setup.

Examples

Build and run example (Linux)
go build examples/stroke/stroke.go
sudo setcap 'cap_net_raw,cap_net_admin=eip' ./stroke
./stroke

Golaunch is released under a BSD-style license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDisconnected is the error returned when there is no connection.
	ErrDisconnected = errors.New("disconnected")
	// ErrDiscover is the error returned when there was an issue
	// discovering the Launch.
	ErrDiscover = errors.New("could not discover launch")
	// ErrInit is the error returned when there was an issue initializing
	// the Launch.
	ErrInit = errors.New("initialization error")
	// ErrUnknownMode is the error returned when someone wants to send a
	// (yet) unknown mode.
	ErrUnknownMode = errors.New("unknown mode")
)

Functions

func NewDefaultDevice

func NewDefaultDevice() (d ble.Device, err error)

NewDefaultDevice is platform specific, see ble documentation for details.

Types

type Launch

type Launch interface {
	// Connect will (re)connect to the Launch.
	Connect(ctx context.Context) error

	// Disconnect will disconnect to the Launch.
	Disconnect()

	// Move moves to position at speed in percent.
	Move(position, speed int)

	// HandleDisconnect registers a function to call when a device disconnects
	HandleDisconnect(f func())
}

Launch interface represents a device that can move like a Launch.

func NewButtplugLaunch

func NewButtplugLaunch(ctx context.Context, addr, name string, tlscfg *tls.Config) Launch

NewButtplugLaunch creates a new Launch connected via the Buttplug server running at addr. Identify with the Buttplug server with the given name.

func NewLaunch

func NewLaunch() Launch

NewLaunch creates and returns a Launch client that can be used to communicate.

func NewLaunchWithDevice

func NewLaunchWithDevice(d ble.Device) Launch

NewLaunchWithDevice creates and returns a Launch client that can be used to communicate over specified Bluetooth device.

Directories

Path Synopsis
examples
random command
stroke command

Jump to

Keyboard shortcuts

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