no.nordicsemi.android.ble.callback.DataReceivedCallback Java Examples

The following examples show how to use no.nordicsemi.android.ble.callback.DataReceivedCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BleMeshManager.java    From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void initialize() {
    requestMtu(MTU_SIZE_MAX).enqueue();

    // This callback will be called each time a notification is received.
    final DataReceivedCallback onDataReceived = (device, data) ->
            mCallbacks.onDataReceived(device, getMaximumPacketSize(), data.getValue());

    // Set the notification callback and enable notification on Data In characteristic.
    final BluetoothGattCharacteristic characteristic = isProvisioningComplete ?
            mMeshProxyDataOutCharacteristic : mMeshProvisioningDataOutCharacteristic;
    setNotificationCallback(characteristic).with(onDataReceived);
    enableNotifications(characteristic).enqueue();
}
 
Example #2
Source File: ReadRequest.java    From Android-BLE-Library with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
@NonNull
public ReadRequest with(@NonNull final DataReceivedCallback callback) {
	super.with(callback);
	return this;
}
 
Example #3
Source File: WaitForValueChangedRequest.java    From Android-BLE-Library with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@NonNull
@Override
public WaitForValueChangedRequest with(@NonNull final DataReceivedCallback callback) {
	super.with(callback);
	return this;
}
 
Example #4
Source File: ValueChangedCallback.java    From Android-BLE-Library with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Sets the asynchronous data callback that will be called whenever a notification or
 * an indication is received on given characteristic.
 *
 * @param callback the data callback.
 * @return The request.
 */
@NonNull
public ValueChangedCallback with(@NonNull final DataReceivedCallback callback) {
	this.valueCallback = callback;
	return this;
}