ESPProvisionManager

public class ESPProvisionManager : NSObject, AVCaptureMetadataOutputObjectsDelegate
extension ESPProvisionManager: ESPBLETransportDelegate

The ESPProvisionManager class is a singleton class. It provides methods for getting ESPDevice object. Provide option to

  • Member to access singleton object of class.

    Declaration

    Swift

    public static let shared: ESPProvisionManager
  • Search for ESPDevice using bluetooth scan. SoftAp search is not yet supported in iOS

    Declaration

    Swift

    public func searchESPDevices(devicePrefix: String, transport: ESPTransport, security: ESPSecurity = .secure, completionHandler: @escaping ([ESPDevice]?, ESPDeviceCSSError?) -> Void)

    Parameters

    devicePrefix

    Prefix of found device should match with devicePrefix.

    transport

    Mode of transport.

    security

    Security mode for communication.

    completionHandler

    The completion handler is called when search for devices is complete. Result of search is returned as parameter of this function. When search is successful array of found devices are returned. When search fails then reaon for failure is returned as ESPDeviceCSSError.

  • Stops searching for Bluetooth devices. Not applicable for SoftAP device type. Any intermediate search result will be ignored. Delegate for peripheralsNotFound is called.

    Declaration

    Swift

    public func stopESPDevicesSearch()
  • Scan for ESPDevice using QR code.

    Declaration

    Swift

    public func scanQRCode(scanView: UIView, completionHandler: @escaping (ESPDevice?, ESPDeviceCSSError?) -> Void, scanStatus: ((ESPScanStatus) -> ())? = nil)

    Parameters

    scanView

    Camera preview layer will be added as subview of this UIView parameter.

    completionHandler

    The completion handler is called when scan method is completed. Result of scan is returned as parameter of this function. When scan is successful found device is returned. When scan fails then reaon for failure is returned as ESPDeviceCSSError.

    scanStatus

    Callback invoked during QR code processing with current status as ESPScanStatus.

  • Stop camera session that is capturing QR code. Call this method when your Scan View goes out of scope.

    Declaration

    Swift

    public func stopScan()
  • Refresh device list with current transport and security settings.

    Declaration

    Swift

    public func refreshDeviceList(completionHandler: @escaping ([ESPDevice]?, ESPDeviceCSSError?) -> Void)

    Parameters

    completionHandler

    The completion handler is called when refresh is completed. Result of refresh is returned as parameter of this function.

  • Undocumented

    Declaration

    Swift

    public func metadataOutput(_: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from _: AVCaptureConnection)
  • Manually create ESPDevice object.

    Declaration

    Swift

    public func createESPDevice(deviceName: String, transport: ESPTransport, security: ESPSecurity = .secure2, proofOfPossession: String? = nil, softAPPassword: String? = nil, username: String? = nil, completionHandler: @escaping (ESPDevice?, ESPDeviceCSSError?) -> Void)

    Parameters

    deviceName

    Name of ESPDevice.

    transport

    Mode of transport.

    security

    Security mode for communication.

    completionHandler

    The completion handler is invoked with parameters containing newly created device object. Error in case where method fails to return a device object.

  • Method to enable/disable library logs.

    Declaration

    Swift

    public func enableLogs(_ enable: Bool)

    Parameters

    enable

    Bool to enable/disable console logs`.

  • Declaration

    Swift

    func peripheralsFound(peripherals: [String : ESPDevice])
  • Declaration

    Swift

    func peripheralsNotFound(serviceUUID _: UUID?)