diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-01-11 12:28:55 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-01-11 12:28:55 +0100 |
commit | 17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52 (patch) | |
tree | 20c2c99e710fd1db438a49029177552204a63591 /app/src/main/java/io/trygvis/android/bt/WrappingBluetoothGattCallback.java | |
parent | 4a2ca2d94c827566f8682e8dbd6fbdf17d70b4dd (diff) | |
download | io.trygvis.soilmoisture-android-17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52.tar.gz io.trygvis.soilmoisture-android-17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52.tar.bz2 io.trygvis.soilmoisture-android-17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52.tar.xz io.trygvis.soilmoisture-android-17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52.zip |
o Reading values from the soil sensor.
o Rewrote the database schema to match the new device+sensors model.
o Storing samples in the database.
o To be able to reuse BT callbacks, added a way to always to directly to the next step instead of waiting for an event.
Diffstat (limited to 'app/src/main/java/io/trygvis/android/bt/WrappingBluetoothGattCallback.java')
-rw-r--r-- | app/src/main/java/io/trygvis/android/bt/WrappingBluetoothGattCallback.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/app/src/main/java/io/trygvis/android/bt/WrappingBluetoothGattCallback.java b/app/src/main/java/io/trygvis/android/bt/WrappingBluetoothGattCallback.java new file mode 100644 index 0000000..8d790d1 --- /dev/null +++ b/app/src/main/java/io/trygvis/android/bt/WrappingBluetoothGattCallback.java @@ -0,0 +1,60 @@ +package io.trygvis.android.bt; + +import android.bluetooth.BluetoothGatt; +import android.bluetooth.BluetoothGattCallback; +import android.bluetooth.BluetoothGattCharacteristic; +import android.bluetooth.BluetoothGattDescriptor; + +class WrappingBluetoothGattCallback extends BluetoothGattCallback { + + private final BluetoothGattCallback wrapped; + + public WrappingBluetoothGattCallback(BluetoothGattCallback wrapped) { + this.wrapped = wrapped; + } + + @Override + public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { + wrapped.onConnectionStateChange(gatt, status, newState); + } + + @Override + public void onServicesDiscovered(BluetoothGatt gatt, int status) { + wrapped.onServicesDiscovered(gatt, status); + } + + @Override + public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { + wrapped.onCharacteristicRead(gatt, characteristic, status); + } + + @Override + public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { + wrapped.onCharacteristicWrite(gatt, characteristic, status); + } + + @Override + public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { + wrapped.onCharacteristicChanged(gatt, characteristic); + } + + @Override + public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { + wrapped.onDescriptorRead(gatt, descriptor, status); + } + + @Override + public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { + wrapped.onDescriptorWrite(gatt, descriptor, status); + } + + @Override + public void onReliableWriteCompleted(BluetoothGatt gatt, int status) { + wrapped.onReliableWriteCompleted(gatt, status); + } + + @Override + public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) { + wrapped.onReadRemoteRssi(gatt, rssi, status); + } +} |