Class CBPeripheral

  • All Implemented Interfaces:
    NSCopying, NSObject

    public class CBPeripheral
    extends CBPeer
    CBPeripheral Represents a peripheral.
    • Constructor Detail

      • CBPeripheral

        protected CBPeripheral​(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()
      • RSSI

        @Deprecated
        public NSNumber RSSI()
        Deprecated.
        Use {@link peripheral:didReadRSSI:error:} instead.
        [@property] RSSI The most recently read RSSI, in decibels.
      • delegate

        public CBPeripheralDelegate delegate()
        [@property] delegate The delegate object that will receive peripheral events.
      • discoverCharacteristicsForService

        public void discoverCharacteristicsForService​(NSArray<? extends CBUUID> characteristicUUIDs,
                                                      CBService service)
        discoverCharacteristics:forService: Discovers the specified characteristic(s) of service.
        Parameters:
        characteristicUUIDs - A list of CBUUID objects representing the characteristic types to be discovered. If nil, all characteristics of service will be discovered.
        service - A GATT service.
      • discoverDescriptorsForCharacteristic

        public void discoverDescriptorsForCharacteristic​(CBCharacteristic characteristic)
        discoverDescriptorsForCharacteristic: Discovers the characteristic descriptor(s) of characteristic.
        Parameters:
        characteristic - A GATT characteristic.
      • discoverIncludedServicesForService

        public void discoverIncludedServicesForService​(NSArray<? extends CBUUID> includedServiceUUIDs,
                                                       CBService service)
        discoverIncludedServices:forService: Discovers the specified included service(s) of service.
        Parameters:
        includedServiceUUIDs - A list of CBUUID objects representing the included service types to be discovered. If nil, all of services included services will be discovered, which is considerably slower and not recommended.
        service - A GATT service.
      • discoverServices

        public void discoverServices​(NSArray<? extends CBUUID> serviceUUIDs)
        discoverServices: Discovers available service(s) on the peripheral.
        Parameters:
        serviceUUIDs - A list of CBUUID objects representing the service types to be discovered. If nil, all services will be discovered.
      • maximumWriteValueLengthForType

        public long maximumWriteValueLengthForType​(long type)
        maximumWriteValueLengthForType: The maximum amount of data, in bytes, that can be sent to a characteristic in a single write type.
      • name

        public java.lang.String name()
        [@property] name The name of the peripheral.
      • readRSSI

        public void readRSSI()
        readRSSI While connected, retrieves the current RSSI of the link.
      • readValueForCharacteristic

        public void readValueForCharacteristic​(CBCharacteristic characteristic)
        readValueForCharacteristic: Reads the characteristic value for characteristic.
        Parameters:
        characteristic - A GATT characteristic.
      • readValueForDescriptor

        public void readValueForDescriptor​(CBDescriptor descriptor)
        readValueForDescriptor: Reads the value of descriptor.
        Parameters:
        descriptor - A GATT characteristic descriptor.
      • services

        public NSArray<? extends CBService> services()
        [@property] services A list of CBService objects that have been discovered on the peripheral.
      • setDelegate_unsafe

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

        public void setDelegate​(CBPeripheralDelegate value)
        [@property] delegate The delegate object that will receive peripheral events.
      • setNotifyValueForCharacteristic

        public void setNotifyValueForCharacteristic​(boolean enabled,
                                                    CBCharacteristic characteristic)
        setNotifyValue:forCharacteristic: Enables or disables notifications/indications for the characteristic value of characteristic. If characteristic allows both, notifications will be used. When notifications/indications are enabled, updates to the characteristic value will be received via delegate method [@link] peripheral:didUpdateValueForCharacteristic:error: @/link. Since it is the peripheral that chooses when to send an update, the application should be prepared to handle them as long as notifications/indications remain enabled.
        Parameters:
        enabled - Whether or not notifications/indications should be enabled.
        characteristic - The characteristic containing the client characteristic configuration descriptor.
        See Also:
        CBConnectPeripheralOptionNotifyOnNotificationKey
      • state

        public long state()
        [@property] state The current connection state of the peripheral.
      • writeValueForCharacteristicType

        public void writeValueForCharacteristicType​(NSData data,
                                                    CBCharacteristic characteristic,
                                                    long type)
        writeValue:forCharacteristic:type: Writes value to characteristic's characteristic value. If the CBCharacteristicWriteWithResponse type is specified, {@link peripheral:didWriteValueForCharacteristic:error:} is called with the result of the write request. If the CBCharacteristicWriteWithoutResponse type is specified, and canSendWriteWithoutResponse is false, the delivery of the data is best-effort and may not be guaranteed.
        Parameters:
        data - The value to write.
        characteristic - The characteristic whose characteristic value will be written.
        type - The type of write to be executed.
        See Also:
        canSendWriteWithoutResponse(), CBCharacteristicWriteType
      • writeValueForDescriptor

        public void writeValueForDescriptor​(NSData data,
                                            CBDescriptor descriptor)
        writeValue:forDescriptor: Writes data to descriptor's value. Client characteristic configuration descriptors cannot be written using this method, and should instead use @link setNotifyValue:forCharacteristic: @/link.
        Parameters:
        data - The value to write.
        descriptor - A GATT characteristic descriptor.
      • canSendWriteWithoutResponse

        public boolean canSendWriteWithoutResponse()
        [@property] canSendWriteWithoutResponse YES if the remote device has space to send a write without response. If this value is NO, the value will be set to YES after the current writes have been flushed, and peripheralIsReadyToSendWriteWithoutResponse: will be called.
      • openL2CAPChannel

        public void openL2CAPChannel​(char PSM)
        openL2CAPChannel: Attempt to open an L2CAP channel to the peripheral using the supplied PSM.
        Parameters:
        PSM - The PSM of the channel to open
      • ancsAuthorized

        public boolean ancsAuthorized()
        [@property] ancsAuthorized YES if the remote device has been authorized to receive data over ANCS (Apple Notification Service Center) protocol. If this value is NO, the value will be set to YES after a user authorization occurs and didUpdateANCSAuthorizationForPeripheral: will be called.