diff --git a/Improv-iOS.podspec b/Improv-iOS.podspec index bb9d23a..dd7dc19 100644 --- a/Improv-iOS.podspec +++ b/Improv-iOS.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "Improv-iOS" - spec.version = "0.0.2" + spec.version = "0.0.3" spec.summary = "Easily detect and connect Improv devices to WiFi networks in iOS" spec.description = "This library abstracts the bluetooth scanning for Improv devices and allow you to connect them to WiFi networks" spec.author = "Improv" diff --git a/Improv-iOS.xcodeproj/xcuserdata/brunopantaleao.xcuserdatad/xcschemes/xcschememanagement.plist b/Improv-iOS.xcodeproj/xcuserdata/brunopantaleao.xcuserdatad/xcschemes/xcschememanagement.plist index 026a775..82379c7 100644 --- a/Improv-iOS.xcodeproj/xcuserdata/brunopantaleao.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Improv-iOS.xcodeproj/xcuserdata/brunopantaleao.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,12 +7,12 @@ Improv-iOS.xcscheme_^#shared#^_ orderHint - 0 + 1 Improve-iOS-Demo.xcscheme_^#shared#^_ orderHint - 1 + 0 diff --git a/Improv-iOS/ImprovManager.swift b/Improv-iOS/ImprovManager.swift index 5721a11..abec188 100644 --- a/Improv-iOS/ImprovManager.swift +++ b/Improv-iOS/ImprovManager.swift @@ -18,6 +18,7 @@ public protocol ImprovManagerProtocol: ObservableObject { func connectToDevice(_ peripheral: CBPeripheral) func identifyDevice() func sendWifi(ssid: String, password: String) + func reset() } public protocol ImprovManagerDelegate: AnyObject { @@ -34,6 +35,8 @@ public protocol ImprovManagerDelegate: AnyObject { func didUpdateErrorState(_ state: ErrorState?) func didReceiveResult(_ result: [String]?) + + func didReset() } public final class ImprovManager: NSObject, ImprovManagerProtocol { @@ -82,6 +85,8 @@ public final class ImprovManager: NSObject, ImprovManagerProtocol { public func stopScan() { bluetoothManager.stopScan() scanInProgress = false + foundDevices = [:] + delegate?.didUpdateFoundDevices(devices: foundDevices) } public func connectToDevice(_ peripheral: CBPeripheral) { @@ -96,6 +101,18 @@ public final class ImprovManager: NSObject, ImprovManagerProtocol { public func sendWifi(ssid: String, password: String) { bluetoothManager.sendWifi(ssid: ssid, password: password) } + + public func reset() { + stopScan() + bluetoothState = bluetoothManager.state + errorState = nil + deviceState = nil + lastResult = nil + foundDevices = [String: CBPeripheral]() + connectedDevice = nil + + delegate?.didReset() + } } extension ImprovManager: BluetoothManagerDelegate {