corebluetooth

package
v0.0.0-...-ba1c585 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2017 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package corebluetooth provides an implementation of ble.Driver using the CoreBluetooth Objective-C API

The bridge rules between the two are as follows:

THREADS:
   Everything in obj-c runs single threaded on a dedicated Grand Central Dispatch queue (read: thread).
   Obj-C is responsible for getting itself on that thread in calls from Go.
   Go is responsible for getting _off_ the obj-c queue via goroutines when calling out to the rest of
   the stack.
MEMORY:
   Callers retain ownership of their memory -- callee must copy right away.
   The exception to this is when memory is returned either via the function or via a double pointer
   (in the case of errorOut following Obj-C semantics of returning BOOL matched with passing of NSError **).
   In this case ownership is transfered and callee must free.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean()

Clean shuts down any existing scans/advertisements, releases the BLE hardware, removes the objective-c singleton from memory, and releases the global driver in this package. It is necessary before New may be called.

Types

type CoreBluetoothDriver

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

CoreBluetoothDriver provides an abstraction for an underlying mechanism to discover near-by Vanadium services through Bluetooth Low Energy (BLE) with CoreBluetooth.

See Driver for more documentation.

func New

func New(ctx *context.T) (*CoreBluetoothDriver, error)

func (*CoreBluetoothDriver) AddService

func (d *CoreBluetoothDriver) AddService(uuid string, characteristics map[string][]byte) error

AddService implements v.io/x/lib/discovery/plugins/ble.Driver.AddService

func (*CoreBluetoothDriver) DebugString

func (d *CoreBluetoothDriver) DebugString() string

DebugString implements v.io/x/lib/discovery/plugins/ble.Driver.DebugString by returning the current state of the CoreBluetooth driver in a string description

func (*CoreBluetoothDriver) NumServicesAdvertising

func (d *CoreBluetoothDriver) NumServicesAdvertising() int

func (*CoreBluetoothDriver) RemoveService

func (d *CoreBluetoothDriver) RemoveService(uuid string)

RemoveService implements v.io/x/lib/discovery/plugins/ble.Driver.RemoveService

func (*CoreBluetoothDriver) StartScan

func (d *CoreBluetoothDriver) StartScan(uuids []string, baseUuid, maskUuid string, handler ble.ScanHandler) error

StartScan implements v.io/x/lib/discovery/plugins/ble.Driver.StartService

func (*CoreBluetoothDriver) StopScan

func (d *CoreBluetoothDriver) StopScan()

StopScan implements v.io/x/lib/discovery/plugins/ble.Driver.StopScan

type OnDiscovered

type OnDiscovered struct {
	UUID            string
	Characteristics map[string][]byte
	RSSI            int
}

Jump to

Keyboard shortcuts

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