Skip to content

Instantly share code, notes, and snippets.

@paulw11
Last active August 29, 2015 14:19
Show Gist options
  • Save paulw11/1ec2077b2d868d48f337 to your computer and use it in GitHub Desktop.
Save paulw11/1ec2077b2d868d48f337 to your computer and use it in GitHub Desktop.
import UIKit
import CoreBluetooth
class ViewController: UIViewController,CBPeripheralManagerDelegate {
var bluetoothManager : CBPeripheralManager?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.bluetoothManager = CBPeripheralManager(delegate: self, queue: nil, options: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func peripheralManagerDidUpdateState(peripheral: CBPeripheralManager!) {
switch (peripheral.state) {
case .PoweredOn:
println("powered on")
case .PoweredOff:
println("powered off")
case .Unsupported:
println("unsupported")
case .Resetting:
println("resetting")
case .Unknown:
println("unknown")
case .Unauthorized:
println("unauthorized")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment