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
func centralManagerDidUpdateState(central: CBCentralManager) { | |
if (central.state == CBCentralManagerState.PoweredOn) { | |
self.centralManager?.scanForPeripheralsWithServices(nil, options: nil) | |
self.currentState.text = "Scanning" | |
} else { | |
print("BLE not on") | |
} | |
} |
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
func startManager(){ | |
centralManager = CBCentralManager(delegate: self, queue: nil) | |
} |
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 CoreBluetooth | |
import UIKit | |
class ViewController: UIViewController, CBCentralManagerDelegate, CBPeripheralDelegate { | |
var centralManager: CBCentralManager! | |
var peripheral: CBPeripheral! | |
override func viewDidLoad() { | |
super.viewDidLoad() |
NewerOlder