Esempio n. 1
0
package option

import "github.com/flemay/gatt"

var DefaultClientOptions = []gatt.Option{
	gatt.MacDeviceRole(gatt.CentralManager),
}

var DefaultServerOptions = []gatt.Option{
	gatt.MacDeviceRole(gatt.PeripheralManager),
}
Esempio n. 2
0
package gonashi

import (
	"strings"
	"sync"
	"time"

	"github.com/eapache/channels"
	"github.com/flemay/gatt"
)

var ClientOptions = []gatt.Option{
	gatt.MacDeviceRole(gatt.CentralManager),
}

type Gonashi struct {
	device     gatt.Device
	discovered *discovered
	connected  *konashiMap
}

func NewGonashi() (Gonashi, error) {
	device, err := gatt.NewDevice(ClientOptions...)
	if err != nil {
		return Gonashi{}, err
	}
	dp := discovered{
		konashiMap{
			sync.RWMutex{},
			map[string]*Konashi{},
			channels.NewOverflowingChannel(1)},