Created
July 12, 2014 09:38
-
-
Save nanki/d63411b4140595f8602a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import IOBluetooth | |
class A: NSObject, CBCentralManagerDelegate { | |
var c: CBCentralManager! | |
init() { | |
super.init() | |
c = CBCentralManager(delegate:self, queue:nil) | |
} | |
func centralManagerDidUpdateState(central: CBCentralManager) { | |
if central.state == CBCentralManagerState.PoweredOn { | |
c.scanForPeripheralsWithServices(nil, options:nil) | |
} | |
} | |
func centralManager(central: CBCentralManager!, didDiscoverPeripheral peripheral: CBPeripheral!, advertisementData data: Dictionary<NSObject, AnyObject>!, RSSI rssi: NSNumber!) { | |
println(peripheral, data, rssi) | |
} | |
} | |
var a = A() | |
NSRunLoop.currentRunLoop().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment