/** * Creates new Enable Indications on Service Changed characteristic. It is a NOOP if such * characteristic does not exist in the Generic Attribute service. * It is required to enable those notifications on bonded devices on older Android versions to * be informed about attributes changes. * Android 7+ (or 6+) handles this automatically and no action is required. * * @return The new request. */ @NonNull static WriteRequest newEnableServiceChangedIndicationsRequest() { return new WriteRequest(Type.ENABLE_SERVICE_CHANGED_INDICATIONS); }
/** * Creates new Disable Notifications on the first found Battery Level characteristic from the * first found Battery Service. If any of them is not found, or the characteristic does not * have the NOTIFY property this operation will not execute. * * @return The new request. * @deprecated Use {@link #newDisableNotificationsRequest(BluetoothGattCharacteristic)} instead. */ @NonNull @Deprecated public static WriteRequest newDisableBatteryLevelNotificationsRequest() { return new WriteRequest(Type.DISABLE_BATTERY_LEVEL_NOTIFICATIONS); }
/** * Creates new Enable Notifications on the first found Battery Level characteristic from the * first found Battery Service. If any of them is not found, or the characteristic does not * have the NOTIFY property this operation will not execute. * * @return The new request. * @deprecated Use {@link #newEnableNotificationsRequest(BluetoothGattCharacteristic)} with * BatteryLevelDataCallback from Android BLE Common Library instead. */ @NonNull @Deprecated public static WriteRequest newEnableBatteryLevelNotificationsRequest() { return new WriteRequest(Type.ENABLE_BATTERY_LEVEL_NOTIFICATIONS); }
/** * Creates new Disable Indications request. The request will not be executed if given * characteristic is null, does not have INDICATE property or the CCCD. * After the operation is complete a proper callback will be invoked. * * @param characteristic characteristic to have indications disabled. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#disableNotifications(BluetoothGattCharacteristic)} instead. */ @Deprecated @NonNull public static WriteRequest newDisableIndicationsRequest( @Nullable final BluetoothGattCharacteristic characteristic) { return new WriteRequest(Type.DISABLE_INDICATIONS, characteristic); }
/** * Creates new Enable Notification request. The request will not be executed if given * characteristic is null, does not have NOTIFY property or the CCCD. * After the operation is complete a proper callback will be invoked. * * @param characteristic characteristic to have notifications enabled. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#enableNotifications(BluetoothGattCharacteristic)} instead. */ @Deprecated @NonNull public static WriteRequest newEnableNotificationsRequest( @Nullable final BluetoothGattCharacteristic characteristic) { return new WriteRequest(Type.ENABLE_NOTIFICATIONS, characteristic); }
/** * Creates new Disable Notification request. The request will not be executed if given * characteristic is null, does not have NOTIFY property or the CCCD. * After the operation is complete a proper callback will be invoked. * * @param characteristic characteristic to have notifications disabled. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#disableNotifications(BluetoothGattCharacteristic)} instead. */ @Deprecated @NonNull public static WriteRequest newDisableNotificationsRequest( @Nullable final BluetoothGattCharacteristic characteristic) { return new WriteRequest(Type.DISABLE_NOTIFICATIONS, characteristic); }
/** * Creates new Enable Indications request. The request will not be executed if given * characteristic is null, does not have INDICATE property or the CCCD. * After the operation is complete a proper callback will be invoked. * * @param characteristic characteristic to have indications enabled. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#enableIndications(BluetoothGattCharacteristic)} instead. */ @Deprecated @NonNull public static WriteRequest newEnableIndicationsRequest( @Nullable final BluetoothGattCharacteristic characteristic) { return new WriteRequest(Type.ENABLE_INDICATIONS, characteristic); }
/** * Creates new Write Descriptor request. The request will not be executed if given descriptor * is null. After the operation is complete a proper callback will be invoked. * * @param descriptor descriptor to be written. * @param value value to be written. The array is copied into another buffer so it's safe * to reuse the array again. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#writeDescriptor(BluetoothGattDescriptor, byte[])} instead. */ @Deprecated @NonNull public static WriteRequest newWriteRequest(@Nullable final BluetoothGattDescriptor descriptor, @Nullable final byte[] value) { return new WriteRequest(Type.WRITE_DESCRIPTOR, descriptor, value, 0, value != null ? value.length : 0); }
/** * Creates new Write Descriptor request. The request will not be executed if given descriptor * is null. After the operation is complete a proper callback will be invoked. * * @param descriptor descriptor to be written. * @param value value to be written. The array is copied into another buffer so it's safe * to reuse the array again. * @param offset the offset from which value has to be copied. * @param length number of bytes to be copied from the value buffer. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#writeDescriptor(BluetoothGattDescriptor, byte[], int, int)} instead. */ @Deprecated @NonNull public static WriteRequest newWriteRequest( @Nullable final BluetoothGattDescriptor descriptor, @Nullable final byte[] value, @IntRange(from = 0) final int offset, @IntRange(from = 0) final int length) { return new WriteRequest(Type.WRITE_DESCRIPTOR, descriptor, value, offset, length); }
/** * Creates new Write Characteristic request. The request will not be executed if given * characteristic is null or does not have WRITE property. * After the operation is complete a proper callback will be invoked. * * @param characteristic characteristic to be written. * @param value value to be written. The array is copied into another buffer so it's * safe to reuse the array again. * @param writeType write type to be used, one of * {@link BluetoothGattCharacteristic#WRITE_TYPE_DEFAULT}, * {@link BluetoothGattCharacteristic#WRITE_TYPE_NO_RESPONSE}. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#writeCharacteristic(BluetoothGattCharacteristic, Data)} instead. */ @Deprecated @NonNull public static WriteRequest newWriteRequest( @Nullable final BluetoothGattCharacteristic characteristic, @Nullable final byte[] value, @WriteType final int writeType) { return new WriteRequest(Type.WRITE, characteristic, value, 0, value != null ? value.length : 0, writeType); }
/** * Creates new Write Characteristic request. The request will not be executed if given * characteristic is null or does not have WRITE property. * After the operation is complete a proper callback will be invoked. * * @param characteristic characteristic to be written. * @param value value to be written. The array is copied into another buffer so it's * safe to reuse the array again. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#writeCharacteristic(BluetoothGattCharacteristic, byte[])} instead. */ @Deprecated @NonNull public static WriteRequest newWriteRequest( @Nullable final BluetoothGattCharacteristic characteristic, @Nullable final byte[] value) { return new WriteRequest(Type.WRITE, characteristic, value, 0, value != null ? value.length : 0, characteristic != null ? characteristic.getWriteType() : BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT); }
/** * Creates new Write Characteristic request. The request will not be executed if given * characteristic is null or does not have WRITE property. * After the operation is complete a proper callback will be invoked. * * @param characteristic characteristic to be written. * @param value value to be written. The array is copied into another buffer so it's * safe to reuse the array again. * @param offset the offset from which value has to be copied. * @param length number of bytes to be copied from the value buffer. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#writeCharacteristic(BluetoothGattCharacteristic, byte[], int, int)} * instead. */ @Deprecated @NonNull public static WriteRequest newWriteRequest( @Nullable final BluetoothGattCharacteristic characteristic, @Nullable final byte[] value, @IntRange(from = 0) final int offset, @IntRange(from = 0) final int length) { return new WriteRequest(Type.WRITE, characteristic, value, offset, length, characteristic != null ? characteristic.getWriteType() : BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT); }
/** * Creates new Write Characteristic request. The request will not be executed if given * characteristic is null or does not have WRITE property. * After the operation is complete a proper callback will be invoked. * * @param characteristic characteristic to be written. * @param value value to be written. The array is copied into another buffer so it's * safe to reuse the array again. * @param offset the offset from which value has to be copied. * @param length number of bytes to be copied from the value buffer. * @param writeType write type to be used, one of * {@link BluetoothGattCharacteristic#WRITE_TYPE_DEFAULT}, * {@link BluetoothGattCharacteristic#WRITE_TYPE_NO_RESPONSE} or * {@link BluetoothGattCharacteristic#WRITE_TYPE_SIGNED}. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#writeCharacteristic(BluetoothGattCharacteristic, byte[], int, int)} * instead. */ @Deprecated @NonNull public static WriteRequest newWriteRequest( @Nullable final BluetoothGattCharacteristic characteristic, @Nullable final byte[] value, @IntRange(from = 0) final int offset, @IntRange(from = 0) final int length, @WriteType final int writeType) { return new WriteRequest(Type.WRITE, characteristic, value, offset, length, writeType); }