Skip to content
Snippets Groups Projects
Commit f24f334c authored by MAUGEZ Emeline's avatar MAUGEZ Emeline
Browse files

On charge les données au lancement de l'appli

parent 55daedac
No related branches found
No related tags found
No related merge requests found
......@@ -142,7 +142,7 @@ public class BluetoothLeService extends Service {
BluetoothGattCharacteristic characteristic,
int status){
super.onCharacteristicWrite(gatt, characteristic, status);
Log.d("hey", "onCharacteristic write status:"+status);
Log.d("hey", "onCharacteristic write status:"+status+", uuid="+ characteristic.getUuid().toString());
}
};
......
......@@ -166,12 +166,17 @@ public class DeviceControl {
mNotifyCharacteristic = null;
mBluetoothLeService.setCharacteristicNotification(
BDRecettesCharacterisitic, false);
//On dort un peu avant d'écouter encore car deux characteristiques ne peuvent pas être écouter en même temps
//Sûrement du au descriptor todo: solved the issue!
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
listenToBDIngredientsCharacteristic();
}
else if (uuid.equals(BDIngredientsCharacteristic.getUuid().toString())){
Intent signalIntent = new Intent("Update Ingredients");
signalIntent.putExtra("message", data);
mContext.sendBroadcast(signalIntent);
Ingredients.getInstance().MiseAJour(data, mContext);
mNotifyCharacteristic = null;
mBluetoothLeService.setCharacteristicNotification(
BDIngredientsCharacteristic, false);
......@@ -232,6 +237,7 @@ public class DeviceControl {
public void listenToBDRecettesCharacteristic() {
Log.d("here", "INDICATION CHARACTERISTIC");
if (BDRecettesCharacterisitic ==null){
Log.d("Characteristic", "BDRecettesCharacteristic is nuuuuuuuull");
onError();
}
else{
......@@ -244,6 +250,7 @@ public class DeviceControl {
public void listenToBDIngredientsCharacteristic() {
Log.d("here", "INDICATION CHARACTERISTIC");
if (BDIngredientsCharacteristic ==null){
Log.d("Characteristic", "BDIngredientsCharacteristic is nuuuuuuuull");
onError();
}
else{
......@@ -303,6 +310,7 @@ public class DeviceControl {
}
else if (uuid.equals(SampleGattAttributes.BD_RECETTES_CHARACTERISTIC)){
BDRecettesCharacterisitic = gattCharacteristic;
listenToBDRecettesCharacteristic();
}
else if(uuid.equals(SampleGattAttributes.BD_INGREDIENTS_CHARACTERISTIC)){
BDIngredientsCharacteristic = gattCharacteristic;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment