nuimo

package module
v0.0.0-...-7e8c7c5 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2016 License: MIT Imports: 9 Imported by: 2

README

Golang library to interact with Nuimo devices

This library uses the currantlabs/ble library and implements an interaction layer for Senic Nuimo devices. Similar to nathankunicki/nuimojs for NodeJS, it was a good inspiration for the library. More production-ready libraries can be find in the official Senic repos.

Disclaimer

At the moment this is a evenings project for me to learn Golang programming and built up some smart home / media control center know how. Feel free to suggest changes which change code and interaction to be more #Golang style.

Example usage*

Please refer to the currantlabs/ble documentation for the basic platform setup. Once the platform is ready run:

go get github.com/tolleiv/nuimo
# Check out the inputs:
sudo go run src/github.com/tolleiv/nuimo/examples/inputs/main.go
# Use the display
sudo go run src/github.com/tolleiv/nuimo/examples/display/main.go

*this has been tested successfully on Linux only

License

MIT License

Documentation

Overview

Package nuimo provides an interaction layer for Senic Nuimo devices. It allows to receive user inputs and can write out led pictographs to the LED display.

Index

Constants

View Source
const CHAR_BATTERY_LEVEL = "2A19"
View Source
const CHAR_DEVICE_INFO = "2A29"
View Source
const CHAR_INPUT_CLICK = "F29B1529CB1940F3BE5C7241ECB82FD2"
View Source
const CHAR_INPUT_FLY = "F29B1526CB1940F3BE5C7241ECB82FD2"
View Source
const CHAR_INPUT_ROTATE = "F29B1528CB1940F3BE5C7241ECB82FD2"
View Source
const CHAR_INPUT_SWIPE = "F29B1527CB1940F3BE5C7241ECB82FD2"
View Source
const CHAR_LED_MATRIX = "F29B1524CB1940F3BE5C7241ECB82FD1"
View Source
const CLICK_DOWN = 1
View Source
const CLICK_UP = 0
View Source
const DIR_BACKWARDS = 2
View Source
const DIR_DOWN = 3
View Source
const DIR_LEFT = 0
View Source
const DIR_RIGHT = 1
View Source
const DIR_TOWARDS = 3
View Source
const DIR_UP = 2
View Source
const DIR_UPDOWN = 4
View Source
const SERVICE_BATTERY_STATUS = "180F"
View Source
const SERVICE_DEVICE_INFO = "180A"
View Source
const SERVICE_LED_MATRIX = "F29B1523CB1940F3BE5C7241ECB82FD1"
View Source
const SERVICE_USER_INPUT = "F29B1525CB1940F3BE5C7241ECB82FD2"

Variables

This section is empty.

Functions

func DisplayMatrix

func DisplayMatrix(dots ...byte) []byte

DisplayMatrix transforms a matrix consisting of 0s and 1s into a byte matrix

Types

type Event

type Event struct {
	Key   string
	Value int64
	Raw   []byte
}

type Nuimo

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

func Connect

func Connect(params ...int) (*Nuimo, error)

Connect tried to find nearby devices and connects to them. It tries to reconnect when a timeout interval is passed as first argument.

func (*Nuimo) Disconnect

func (n *Nuimo) Disconnect() error

Disconnect closes the connection and drops all subscriptions

func (*Nuimo) Display

func (n *Nuimo) Display(matrix []byte, brightness uint8, timeout uint8)

Display sends the passed byte atrix into the LED display of the Nuimo

func (*Nuimo) Events

func (n *Nuimo) Events() <-chan Event

Events provides access to the events channel which contains the user interaction and battery level events

Directories

Path Synopsis
examples
display command
inputs command

Jump to

Keyboard shortcuts

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