CBLCoreCameraDiscoveryProvider

Objective-C

@protocol CBLCoreCameraDiscoveryProvider <NSObject>

Swift

protocol CameraDiscoveryProvider : NSObjectProtocol

Implement the CBLCoreCameraDiscoveryProvider protocol in order to provide custom cameras and camera discovery to CascableCore. You can then register your camera provider with CascableCore in the plugin entrypoint.

  • Start the discovery process in the given mode. If the mode given doesn’t apply to your situation (i.e., the mode is CBLCameraDiscoveryModeUSBOnly and you only support network comms), you shouldn’t do anything.

    When searching, the visibleCameras property should be updated as cameras appear or disappear, after which discovery messages should be delivered to the delegate, if present. Clients are encouraged to perform searches in the background, but messages to the delegate must be performed on the main queue/thread.

    Declaration

    Objective-C

    - (void)startDiscoveryInMode:(CBLCameraDiscoveryMode)discoveryMode
                      clientName:(NSString *_Nonnull)clientName;

    Swift

    func startDiscovery(in discoveryMode: CameraDiscoveryMode, clientName: String)

    Parameters

    discoveryMode

    The mode in which to perform the search.

    clientName

    The client name to use when connecting/pairing to cameras.

  • Stop discovery and clean up any resources used by the discovery process. May be called without a preceding call to -startDiscoveryInMode:clientName:.

    Declaration

    Objective-C

    - (void)stopDiscovery;

    Swift

    func stopDiscovery()
  • Returns an array of the currently visible cameras.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly, nonnull) NSArray<id<CBLCamera>> *visibleCameras;

    Swift

    var visibleCameras: [CBLCamera] { get }
  • CascableCore will set the delegate as appropriate. Messages delivered to this delegate should be done so on the main thread/queue.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<CBLCoreCameraDiscoveryProviderDelegate> delegate;

    Swift

    weak var delegate: CameraDiscoveryProviderDelegate? { get set }
  • Returns a unique identifier for the provider. Can be the plugin’s bundle ID if it only has one provider.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly, nonnull) NSString *providerIdentifier;

    Swift

    var providerIdentifier: String { get }