Connection
public protocol Connection
The protocol for a (Bluetooth or 2.4G) Connection
-
Callback when a device is connected
Declaration
Swift
var onConnect: (() -> Void)? { get set }
-
Callback when a device is disconnected
Declaration
Swift
var onDisconnect: (() -> Void)? { get set }
-
Callback when the available device list is changed (Maybe new device is discovered or an old one disappeared)
Declaration
Swift
var onAvailableDevicesChanged: (([Device]) -> Void)? { get set }
-
Callback when the connect received data
Declaration
Swift
var onReceive: ((NSData) -> Void)? { get set }
-
start discovering devices
Declaration
Swift
func startDiscovery()
-
stop discovering devices
Declaration
Swift
func stopDiscovery()
-
Undocumented
Declaration
Swift
public protocol Connection
-
try to connect to a random device
Declaration
Swift
func connectDefaultDevice()
-
Undocumented
Declaration
Swift
public protocol Connection
-
send data through the connection
Declaration
Swift
func send(data: NSData)
Parameters
data
the data to be sent