Class CBCentralManager

  • All Implemented Interfaces:
    NSObject

    public class CBCentralManager
    extends CBManager
    CBCentralManager Entry point to the central role. Commands should only be issued when its state is CBCentralManagerStatePoweredOn.
    • Constructor Detail

      • CBCentralManager

        protected CBCentralManager​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • cancelPeripheralConnection

        public void cancelPeripheralConnection​(CBPeripheral peripheral)
        cancelPeripheralConnection: Cancels an active or pending connection to peripheral. Note that this is non-blocking, and any CBPeripheral commands that are still pending to peripheral may or may not complete.
        Parameters:
        peripheral - A CBPeripheral.
      • connectPeripheralOptions

        public void connectPeripheralOptions​(CBPeripheral peripheral,
                                             NSDictionary<java.lang.String,​?> options)
        connectPeripheral:options: Initiates a connection to peripheral. Connection attempts never time out and, depending on the outcome, will result in a call to either {@link centralManager:didConnectPeripheral:} or {@link centralManager:didFailToConnectPeripheral:error:}. Pending attempts are cancelled automatically upon deallocation of peripheral, and explicitly via cancelPeripheralConnection(apple.corebluetooth.CBPeripheral).
        Parameters:
        peripheral - The CBPeripheral to be connected.
        options - An optional dictionary specifying connection behavior options.
        See Also:
        CBConnectPeripheralOptionNotifyOnConnectionKey, CBConnectPeripheralOptionNotifyOnDisconnectionKey, CBConnectPeripheralOptionNotifyOnNotificationKey, CBConnectPeripheralOptionEnableTransportBridgingKey, CBConnectPeripheralOptionRequiresANCS
      • delegate

        public CBCentralManagerDelegate delegate()
        [@property] delegate The delegate object that will receive central events.
      • initWithDelegateQueue

        public CBCentralManager initWithDelegateQueue​(CBCentralManagerDelegate delegate,
                                                      NSObject queue)
        initWithDelegate:queue: The initialization call. The events of the central role will be dispatched on the provided queue. If nil, the main queue will be used.
        Parameters:
        delegate - The delegate that will receive central role events.
        queue - The dispatch queue on which the events will be dispatched.
      • initWithDelegateQueueOptions

        public CBCentralManager initWithDelegateQueueOptions​(CBCentralManagerDelegate delegate,
                                                             NSObject queue,
                                                             NSDictionary<java.lang.String,​?> options)
        initWithDelegate:queue:options: The initialization call. The events of the central role will be dispatched on the provided queue. If nil, the main queue will be used.
        Parameters:
        delegate - The delegate that will receive central role events.
        queue - The dispatch queue on which the events will be dispatched.
        options - An optional dictionary specifying options for the manager.
        See Also:
        CBCentralManagerOptionShowPowerAlertKey, CBCentralManagerOptionRestoreIdentifierKey
      • isScanning

        public boolean isScanning()
        [@property] isScanning Whether or not the central is currently scanning.
      • retrieveConnectedPeripheralsWithServices

        public NSArray<? extends CBPeripheral> retrieveConnectedPeripheralsWithServices​(NSArray<? extends CBUUID> serviceUUIDs)
        retrieveConnectedPeripheralsWithServices Retrieves all peripherals that are connected to the system and implement any of the services listed in serviceUUIDs. Note that this set can include peripherals which were connected by other applications, which will need to be connected locally via {@link connectPeripheral:options:} before they can be used.
        Returns:
        A list of CBPeripheral objects.
      • retrievePeripheralsWithIdentifiers

        public NSArray<? extends CBPeripheral> retrievePeripheralsWithIdentifiers​(NSArray<? extends NSUUID> identifiers)
        retrievePeripheralsWithIdentifiers: Attempts to retrieve the CBPeripheral object(s) with the corresponding identifiers.
        Parameters:
        identifiers - A list of NSUUID objects.
        Returns:
        A list of CBPeripheral objects.
      • scanForPeripheralsWithServicesOptions

        public void scanForPeripheralsWithServicesOptions​(NSArray<? extends CBUUID> serviceUUIDs,
                                                          NSDictionary<java.lang.String,​?> options)
        scanForPeripheralsWithServices:options: Starts scanning for peripherals that are advertising any of the services listed in serviceUUIDs. Although strongly discouraged, if serviceUUIDs is nil all discovered peripherals will be returned. If the central is already scanning with different serviceUUIDs or options, the provided parameters will replace them. Applications that have specified the bluetooth-central background mode are allowed to scan while backgrounded, with two caveats: the scan must specify one or more service types in serviceUUIDs, and the CBCentralManagerScanOptionAllowDuplicatesKey scan option will be ignored.
        Parameters:
        serviceUUIDs - A list of CBUUID objects representing the service(s) to scan for.
        options - An optional dictionary specifying options for the scan.
        See Also:
        CBCentralManagerScanOptionAllowDuplicatesKey, CBCentralManagerScanOptionSolicitedServiceUUIDsKey
      • setDelegate_unsafe

        public void setDelegate_unsafe​(CBCentralManagerDelegate value)
        [@property] delegate The delegate object that will receive central events.
      • setDelegate

        public void setDelegate​(CBCentralManagerDelegate value)
        [@property] delegate The delegate object that will receive central events.
      • stopScan

        public void stopScan()
        stopScan: Stops scanning for peripherals.
      • authorization_static

        public static long authorization_static()
      • registerForConnectionEventsWithOptions

        public void registerForConnectionEventsWithOptions​(NSDictionary<java.lang.String,​?> options)
        registerForConnectionEventsWithOptions: Calls {@link centralManager:connectionEventDidOccur:forPeripheral:} when a connection event occurs matching any of the given options. Passing nil in the option parameter clears any prior registered matching options.
        Parameters:
        options - A dictionary specifying connection event options.
        See Also:
        CBConnectionEventMatchingOptionServiceUUIDs, CBConnectionEventMatchingOptionPeripheralUUIDs
      • supportsFeatures

        public static boolean supportsFeatures​(long features)
        supportsFeatures Returns a boolean value representing the support for the provided features.
        Parameters:
        features - One or more features you would like to check if supported.