- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {LocalDateTime l =
new LocalDateTime()
LocalDateTime.now()
DateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
- Smart code suggestions by Codota
}
/** * Creates new Read Battery Level request. The first found Battery Level characteristic value * from the first found Battery Service. If any of them is not found, or the characteristic * does not have the READ property this operation will not execute. * * @return The new request. * @deprecated Use {@link #newReadRequest(BluetoothGattCharacteristic)} with * BatteryLevelDataCallback from Android BLE Common Library instead. */ @NonNull @Deprecated public static ReadRequest newReadBatteryLevelRequest() { return new ReadRequest(Type.READ_BATTERY_LEVEL); }
/** * Reads the battery level from the device. * * @deprecated Use {@link #readCharacteristic(BluetoothGattCharacteristic)} instead. */ @SuppressWarnings("ConstantConditions") @Deprecated protected void readBatteryLevel() { Request.newReadBatteryLevelRequest().setManager(this) .with((device, data) -> { if (data.size() == 1) { final int batteryLevel = data.getIntValue(Data.FORMAT_UINT8, 0); log(Log.INFO, "Battery Level received: " + batteryLevel + "%"); mBatteryValue = batteryLevel; final BleManagerGattCallback callback = mGattCallback; if (callback != null) { callback.onBatteryValueReceived(mBluetoothGatt, batteryLevel); } mCallbacks.onBatteryValueReceived(device, batteryLevel); } }) .enqueue(); }
.merge((output, lastPacket, index) -> { assertTrue(data.length <= MTU - 3); }) .with((device, data) -> { .done(device -> done = true); readRequest.notifyValueChanged(null, chunk); readRequest.notifySuccess(null); assertTrue(done);
@Override protected void onDeviceReady() { super.onDeviceReady(); // Initialization is now ready. // The service or activity has been notified with TemplateManagerCallbacks#onDeviceReady(). // TODO Do some extra logic here, of remove onDeviceReady(). // Device is ready, let's read something here. Usually there is nothing else to be done // here, as all had been done during initialization. readCharacteristic(mOptionalCharacteristic) .with((device, data) -> { // Characteristic value has been read // Let's do some magic with it. if (data.size() > 0) { final Integer value = data.getIntValue(Data.FORMAT_UINT8, 0); log(LogContract.Log.Level.APPLICATION, "Value '" + value + "' has been read!"); } else { log(Log.WARN, "Value is empty!"); } }) .enqueue(); } };
throws RequestFailedException, InvalidDataException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException { final E response = await(responseClass); if (!response.isValid()) { throw new InvalidDataException(response);
throws RequestFailedException, InvalidDataException, DeviceDisconnectedException, BluetoothDisabledException, InvalidRequestException { await(response); if (!response.isValid()) { throw new InvalidDataException(response);
super.initialize(); readCharacteristic(mBodySensorLocationCharacteristic) .with(new BodySensorLocationDataCallback() { @Override public void onDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data) { .fail((device, status) -> log(Log.WARN, "Body Sensor Location characteristic not found")) .enqueue(); setNotificationCallback(mHeartRateCharacteristic) .with(new HeartRateMeasurementDataCallback() {
/** * Creates new Read 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 read. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#readDescriptor(BluetoothGattDescriptor)} instead. */ @Deprecated @NonNull public static ReadRequest newReadRequest(@Nullable final BluetoothGattDescriptor descriptor) { return new ReadRequest(Type.READ_DESCRIPTOR, descriptor); }
.with(new CGMFeatureDataCallback() { @Override public void onContinuousGlucoseMonitorFeaturesReceived(@NonNull final BluetoothDevice device, @NonNull final CGMFeatures features, .fail((device, status) -> log(Log.WARN, "Could not read CGM Feature characteristic")) .enqueue(); .with(new CGMStatusDataCallback() { @Override public void onContinuousGlucoseMonitorStatusChanged(@NonNull final BluetoothDevice device, @NonNull final CGMStatus status, final int timeOffset, final boolean secured) { .fail((device, status) -> log(Log.WARN, "Could not read CGM Status characteristic")) .enqueue();
/** * Creates new Read Characteristic request. The request will not be executed if given * characteristic is null or does not have READ property. * After the operation is complete a proper callback will be invoked. * * @param characteristic characteristic to be read. * @return The new request. * @deprecated Access to this method will change to package-only. * Use {@link BleManager#readCharacteristic(BluetoothGattCharacteristic)} instead. */ @Deprecated @NonNull public static ReadRequest newReadRequest( @Nullable final BluetoothGattCharacteristic characteristic) { return new ReadRequest(Type.READ, characteristic); }