Skip to content

Commit

Permalink
Added the ability to get a previously scanned remote peripheral
Browse files Browse the repository at this point in the history
  • Loading branch information
barelyreal committed Aug 10, 2016
1 parent 9942df8 commit 1bd13a1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Source/BKCentral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,23 @@ public class BKCentral: BKPeer, BKCBCentralManagerStateDelegate, BKConnectionPoo
throw BKError.InternalError(underlyingError: error)
}
}

public func retrieveRemotePeripheralWithUUID (remoteUUID: NSUUID) -> BKRemotePeripheral? {

if let centralManager = _centralManager {
let peripherals = centralManager.retrievePeripheralsWithIdentifiers([remoteUUID])
guard peripherals.count > 0 else {
// We have never scanned this peripheral before
return nil
}

let peripheral = BKRemotePeripheral(identifier: remoteUUID, peripheral: peripherals[0])
return peripheral
}
else {
return nil
}
}

// MARK: Internal Functions

Expand Down

0 comments on commit 1bd13a1

Please sign in to comment.