CBLHotspotHelpers

Objective-C


@interface CBLHotspotHelpers : NSObject

Swift

class HotspotHelpers : NSObject

The CBLHotspotHelpers class contains logic for connecting the host device to the given WiFi network.

  • The shared object.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly, nonnull) CBLHotspotHelpers *sharedInstance;

    Swift

    class var shared: HotspotHelpers { get }
  • Returns YES if location permission is required to connect to a WiFi network, otherwise NO.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly) BOOL requiresLocationPermission;

    Swift

    class var requiresLocationPermission: Bool { get }
  • Attempt to join the given WiFi network.

    Note

    Joining a WiFi network can take upwards of 20-30 seconds.

    Declaration

    Objective-C

    - (void)attemptToJoinWiFiNetwork:(NSString *_Nonnull)ssid
                            password:(NSString *_Nonnull)password
        promptingForLocationIfNeeded:(BOOL)promptForLocation
                   completionHandler:
                       (CBLHotspotCompletion _Nonnull)completionHandler
                     completionQueue:(dispatch_queue_t _Nonnull)completionQueue;

    Swift

    func attemptToJoinWiFiNetwork(_ ssid: String, password: String, promptingForLocationIfNeeded promptForLocation: Bool, completionHandler: @escaping HotspotCompletion, completionQueue: dispatch_queue_t)

    Parameters

    ssid

    The SSID of the network to join.

    password

    The password of the network to join.

    promptForLocation

    If the current platform requires location permission to connect to a network, pass YES to automatically prompt for that permission if needed.

    completionHandler

    The completion handler to call upon success or failure.

    completionQueue

    The queue on which to call the completion handler.

  • Attempt to join the WiFi network described by the given QR code scanning result. See id <CBLCameraQRDecoding> for details.

    Note

    Joining a WiFi network can take upwards of 20-30 seconds.

    Declaration

    Objective-C

    - (void)attemptToJoinQRCodeNetwork:
                (CBLCameraWiFiDetails *_Nonnull)networkDetails
          promptingForLocationIfNeeded:(BOOL)promptForLocation
                     completionHandler:
                         (CBLHotspotCompletion _Nonnull)completionHandler
                       completionQueue:(dispatch_queue_t _Nonnull)completionQueue;

    Swift

    func attemptToJoinQRCodeNetwork(_ networkDetails: CameraWiFiDetails, promptingForLocationIfNeeded promptForLocation: Bool, completionHandler: @escaping HotspotCompletion, completionQueue: dispatch_queue_t)

    Parameters

    networkDetails

    The details of the network to join.

    promptForLocation

    If the current platform requires location permission to connect to a network, pass YES to automatically prompt for that permission if needed.

    completionHandler

    The completion handler to call upon success or failure.

    completionQueue

    The queue on which to call the completion handler.