 
 import Foundation
 import CoreBluetooth
+import XCGLogger
+import Async
 
 // MARK: -
 // MARK: EPLCentralManagerDelegate Protocol
 @objc public protocol EPLCentralManagerDelegate {
     // required functions
     func afterBLEIsReady(central: EPLCentralManager!)
-    func afterScanIsDone(central: EPLCentralManager!)
+    func didDiscoverPeripherals(central: EPLCentralManager!)
     func didConnectedPeripheral(peripheral: EPLPeripheral!)
     
     // optional functions
+    optional func afterScanTimeout(central: EPLCentralManager!)
 }
 
 // MARK: -

public class EPLCentralManager: NSObject, CBCentralManagerDelegate {
    // MARK: -
    // MARK: Private variables
    private var cbCentralManager: CBCentralManager?
    private let centralQueue = dispatch_queue_create("epl.ble.central.main", DISPATCH_QUEUE_SERIAL)
    private var _ble_ready: Bool = false
    private var scanOption:Dictionary<String, AnyObject> = [:]
    
    private var scanTimer:NSTimer?
    
    // MARK: -
    // MARK: Internal variables
    

    }
    
    public func centralManager(central: CBCentralManager!, didRetrieveConnectedPeripherals peripherals: [AnyObject]!) {
        log.debug("didRetrieveConnected")
        if let ps = peripherals {
            for p in ps {
                let p = p as! CBPeripheral
