Last active
August 29, 2015 14:19
-
-
Save paulw11/1ec2077b2d868d48f337 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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