Created
March 15, 2017 16:03
-
-
Save yostane/56bb6378ad214823be96ac5fcf11d0d4 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
| //we will next discover the "ec00" service in order be able to access its characteristics | |
| let discoveryFuture = connectionFuture.flatMap { peripheral -> Future<Peripheral> in | |
| return peripheral.discoverServices([serviceUUID]) | |
| }.flatMap { discoveredPeripheral -> Future<Service> in | |
| guard let service = discoveredPeripheral.service(serviceUUID) else { | |
| throw AppError.serviceNotFound | |
| } | |
| peripheral = discoveredPeripheral | |
| DispatchQueue.main.async { | |
| self.connectionStatusLabel.text = "Discovered service \(service.uuid.uuidString). Trying to discover characteristics" | |
| print(self.connectionStatusLabel.text!) | |
| } | |
| //we have discovered the service, the next step is to discover the "ec0e" characteristic | |
| return service.discoverCharacteristics([dateCharacteristicUUID]) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment