Last active
December 10, 2016 14:21
-
-
Save nanki/5c34ad8f6b3bda481bc9 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
framework 'IOBluetooth' | |
class A | |
def initialize | |
@c = CBCentralManager.alloc.initWithDelegate(self, queue:nil) | |
end | |
def centralManagerDidUpdateState(central) | |
if central.state == CBCentralManagerStatePoweredOn | |
@c.scanForPeripheralsWithServices(nil, options:nil) | |
end | |
end | |
def centralManager(central, didDiscoverPeripheral:peripheral, advertisementData:data, RSSI:rssi) | |
puts NSString.stringWithFormat("peripheral: %@\nadvertisementData: %@\nrssi: %@", peripheral, data, rssi) | |
end | |
end | |
A.new | |
NSRunLoop.currentRunLoop.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment