reformat code
This commit is contained in:
parent
c4590d3989
commit
dbbcf20bbc
|
@ -176,9 +176,10 @@ public class GB {
|
||||||
* Creates and display a Toast message using the application context.
|
* Creates and display a Toast message using the application context.
|
||||||
* Additionally the toast is logged using the provided severity.
|
* Additionally the toast is logged using the provided severity.
|
||||||
* Can be called from any thread.
|
* Can be called from any thread.
|
||||||
* @param message the message to display.
|
*
|
||||||
|
* @param message the message to display.
|
||||||
* @param displayTime something like Toast.LENGTH_SHORT
|
* @param displayTime something like Toast.LENGTH_SHORT
|
||||||
* @param severity either INFO, WARNING, ERROR
|
* @param severity either INFO, WARNING, ERROR
|
||||||
*/
|
*/
|
||||||
public static void toast(String message, int displayTime, int severity) {
|
public static void toast(String message, int displayTime, int severity) {
|
||||||
toast(GBApplication.getContext(), message, displayTime, severity, null);
|
toast(GBApplication.getContext(), message, displayTime, severity, null);
|
||||||
|
@ -188,9 +189,10 @@ public class GB {
|
||||||
* Creates and display a Toast message using the application context.
|
* Creates and display a Toast message using the application context.
|
||||||
* Additionally the toast is logged using the provided severity.
|
* Additionally the toast is logged using the provided severity.
|
||||||
* Can be called from any thread.
|
* Can be called from any thread.
|
||||||
* @param message the message to display.
|
*
|
||||||
|
* @param message the message to display.
|
||||||
* @param displayTime something like Toast.LENGTH_SHORT
|
* @param displayTime something like Toast.LENGTH_SHORT
|
||||||
* @param severity either INFO, WARNING, ERROR
|
* @param severity either INFO, WARNING, ERROR
|
||||||
*/
|
*/
|
||||||
public static void toast(String message, int displayTime, int severity, Throwable ex) {
|
public static void toast(String message, int displayTime, int severity, Throwable ex) {
|
||||||
toast(GBApplication.getContext(), message, displayTime, severity, ex);
|
toast(GBApplication.getContext(), message, displayTime, severity, ex);
|
||||||
|
@ -199,23 +201,25 @@ public class GB {
|
||||||
/**
|
/**
|
||||||
* Creates and display a Toast message using the application context
|
* Creates and display a Toast message using the application context
|
||||||
* Can be called from any thread.
|
* Can be called from any thread.
|
||||||
* @param context the context to use
|
*
|
||||||
* @param message the message to display
|
* @param context the context to use
|
||||||
|
* @param message the message to display
|
||||||
* @param displayTime something like Toast.LENGTH_SHORT
|
* @param displayTime something like Toast.LENGTH_SHORT
|
||||||
* @param severity either INFO, WARNING, ERROR
|
* @param severity either INFO, WARNING, ERROR
|
||||||
*/
|
*/
|
||||||
public static void toast(final Context context, final String message, final int displayTime, final int severity) {
|
public static void toast(final Context context, final String message, final int displayTime, final int severity) {
|
||||||
toast(context, message, displayTime, severity, null);
|
toast(context, message, displayTime, severity, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and display a Toast message using the application context
|
* Creates and display a Toast message using the application context
|
||||||
* Can be called from any thread.
|
* Can be called from any thread.
|
||||||
* @param context the context to use
|
*
|
||||||
* @param message the message to display
|
* @param context the context to use
|
||||||
|
* @param message the message to display
|
||||||
* @param displayTime something like Toast.LENGTH_SHORT
|
* @param displayTime something like Toast.LENGTH_SHORT
|
||||||
* @param severity either INFO, WARNING, ERROR
|
* @param severity either INFO, WARNING, ERROR
|
||||||
* @param ex optional exception to be logged
|
* @param ex optional exception to be logged
|
||||||
*/
|
*/
|
||||||
public static void toast(final Context context, final String message, final int displayTime, final int severity, final Throwable ex) {
|
public static void toast(final Context context, final String message, final int displayTime, final int severity, final Throwable ex) {
|
||||||
Looper mainLooper = Looper.getMainLooper();
|
Looper mainLooper = Looper.getMainLooper();
|
||||||
|
|
|
@ -24,7 +24,6 @@ import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.charts.ActivityKind;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.charts.SleepUtils;
|
import nodomain.freeyourgadget.gadgetbridge.charts.SleepUtils;
|
||||||
|
|
||||||
public abstract class AbstractChartFragment extends Fragment {
|
public abstract class AbstractChartFragment extends Fragment {
|
||||||
|
@ -62,7 +61,7 @@ public abstract class AbstractChartFragment extends Fragment {
|
||||||
case nodomain.freeyourgadget.gadgetbridge.charts.ActivityKind.TYPE_LIGHT_SLEEP:
|
case nodomain.freeyourgadget.gadgetbridge.charts.ActivityKind.TYPE_LIGHT_SLEEP:
|
||||||
return akLightSleep.color;
|
return akLightSleep.color;
|
||||||
case nodomain.freeyourgadget.gadgetbridge.charts.ActivityKind.TYPE_ACTIVITY:
|
case nodomain.freeyourgadget.gadgetbridge.charts.ActivityKind.TYPE_ACTIVITY:
|
||||||
return akActivity.color;
|
return akActivity.color;
|
||||||
}
|
}
|
||||||
return akActivity.color;
|
return akActivity.color;
|
||||||
}
|
}
|
||||||
|
@ -290,7 +289,7 @@ public abstract class AbstractChartFragment extends Fragment {
|
||||||
|
|
||||||
protected abstract void setupLegend(Chart chart);
|
protected abstract void setupLegend(Chart chart);
|
||||||
|
|
||||||
protected BarEntry createBarEntry(float value, int index) {
|
protected BarEntry createBarEntry(float value, int index) {
|
||||||
return new BarEntry(value, index);
|
return new BarEntry(value, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package nodomain.freeyourgadget.gadgetbridge.activities;
|
package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||||
|
|
||||||
import android.bluetooth.BluetoothDevice;
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -13,13 +12,10 @@ import android.support.v4.app.FragmentPagerAdapter;
|
||||||
import android.support.v4.app.FragmentStatePagerAdapter;
|
import android.support.v4.app.FragmentStatePagerAdapter;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -126,7 +122,7 @@ public class ChartsActivity extends FragmentActivity {
|
||||||
startService(startIntent);
|
startService(startIntent);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
|
|
@ -23,7 +23,6 @@ import com.github.mikephil.charting.utils.ValueFormatter;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -97,7 +96,7 @@ public class SleepChartFragment extends AbstractChartFragment {
|
||||||
set.setValueFormatter(new ValueFormatter() {
|
set.setValueFormatter(new ValueFormatter() {
|
||||||
@Override
|
@Override
|
||||||
public String getFormattedValue(float value) {
|
public String getFormattedValue(float value) {
|
||||||
return GB.formatDurationHoursMinutes((long)value, TimeUnit.SECONDS);
|
return GB.formatDurationHoursMinutes((long) value, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
set.setColors(colors);
|
set.setColors(colors);
|
||||||
|
|
|
@ -5,7 +5,6 @@ import android.bluetooth.BluetoothGattCharacteristic;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Bluedroid implementation only allows performing one GATT request at a time.
|
* The Bluedroid implementation only allows performing one GATT request at a time.
|
||||||
|
|
|
@ -188,7 +188,7 @@ public final class BtLEQueue {
|
||||||
// To support automatic reconnection, we keep the mBluetoothGatt instance
|
// To support automatic reconnection, we keep the mBluetoothGatt instance
|
||||||
// alive (we do not close() it). Unfortunately we sometimes have problems
|
// alive (we do not close() it). Unfortunately we sometimes have problems
|
||||||
// reconnecting automatically, so we try to fix this by re-creating mBluetoothGatt.
|
// reconnecting automatically, so we try to fix this by re-creating mBluetoothGatt.
|
||||||
if (status != 0 ) {
|
if (status != 0) {
|
||||||
maybeReconnect();
|
maybeReconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package nodomain.freeyourgadget.gadgetbridge.charts;
|
package nodomain.freeyourgadget.gadgetbridge.charts;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
|
import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
|
||||||
|
@ -13,7 +12,7 @@ public class ActivityAnalysis {
|
||||||
|
|
||||||
ActivityAmount previousAmount = null;
|
ActivityAmount previousAmount = null;
|
||||||
GBActivitySample previousSample = null;
|
GBActivitySample previousSample = null;
|
||||||
for(GBActivitySample sample : samples) {
|
for (GBActivitySample sample : samples) {
|
||||||
ActivityAmount amount = null;
|
ActivityAmount amount = null;
|
||||||
switch (sample.getType()) {
|
switch (sample.getType()) {
|
||||||
case GBActivitySample.TYPE_DEEP_SLEEP:
|
case GBActivitySample.TYPE_DEEP_SLEEP:
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GB;
|
import nodomain.freeyourgadget.gadgetbridge.GB;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
|
import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
|
||||||
|
@ -132,9 +131,10 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper {
|
||||||
/**
|
/**
|
||||||
* Returns all available activity samples from between the two timestamps (inclusive), of the given
|
* Returns all available activity samples from between the two timestamps (inclusive), of the given
|
||||||
* provided and type(s).
|
* provided and type(s).
|
||||||
|
*
|
||||||
* @param timestamp_from
|
* @param timestamp_from
|
||||||
* @param timestamp_to
|
* @param timestamp_to
|
||||||
* @param activityTypes ORed combination of #TYPE_DEEP_SLEEP, #TYPE_LIGHT_SLEEP, #TYPE_ACTIVITY
|
* @param activityTypes ORed combination of #TYPE_DEEP_SLEEP, #TYPE_LIGHT_SLEEP, #TYPE_ACTIVITY
|
||||||
* @param provider
|
* @param provider
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -143,7 +143,7 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper {
|
||||||
timestamp_to = Integer.MAX_VALUE; // dont know what happens when I use more than max of a signed int
|
timestamp_to = Integer.MAX_VALUE; // dont know what happens when I use more than max of a signed int
|
||||||
}
|
}
|
||||||
ArrayList<GBActivitySample> GBActivitySampleList = new ArrayList<GBActivitySample>();
|
ArrayList<GBActivitySample> GBActivitySampleList = new ArrayList<GBActivitySample>();
|
||||||
final String where = "(provider=" + provider + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + getWhereClauseFor(activityTypes) +")";
|
final String where = "(provider=" + provider + " and timestamp>=" + timestamp_from + " and timestamp<=" + timestamp_to + getWhereClauseFor(activityTypes) + ")";
|
||||||
final String order = "timestamp";
|
final String order = "timestamp";
|
||||||
try (SQLiteDatabase db = this.getReadableDatabase()) {
|
try (SQLiteDatabase db = this.getReadableDatabase()) {
|
||||||
Cursor cursor = db.query(TABLE_GBACTIVITYSAMPLES, null, where, null, null, null, order);
|
Cursor cursor = db.query(TABLE_GBACTIVITYSAMPLES, null, where, null, null, null, order);
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
|
@ -7,10 +7,11 @@ import android.database.sqlite.SQLiteDatabase;
|
||||||
* Implementors provide the update from the prior schema
|
* Implementors provide the update from the prior schema
|
||||||
* version to this version, and the downgrade from this schema
|
* version to this version, and the downgrade from this schema
|
||||||
* version to the next lower version.
|
* version to the next lower version.
|
||||||
*
|
* <p/>
|
||||||
* Implementations must have a public, no-arg constructor.
|
* Implementations must have a public, no-arg constructor.
|
||||||
*/
|
*/
|
||||||
public interface DBUpdateScript {
|
public interface DBUpdateScript {
|
||||||
void upgradeSchema(SQLiteDatabase database);
|
void upgradeSchema(SQLiteDatabase database);
|
||||||
|
|
||||||
void downgradeSchema(SQLiteDatabase database);
|
void downgradeSchema(SQLiteDatabase database);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,13 @@ package nodomain.freeyourgadget.gadgetbridge.database.schema;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBUpdateScript;
|
|
||||||
|
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.*;
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_INTENSITY;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_PROVIDER;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_STEPS;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_TIMESTAMP;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_TYPE;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.TABLE_GBACTIVITYSAMPLES;
|
||||||
|
|
||||||
public class ActivityDBCreationScript {
|
public class ActivityDBCreationScript {
|
||||||
public void createSchema(SQLiteDatabase db) {
|
public void createSchema(SQLiteDatabase db) {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBUpdateScript;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBUpdateScript;
|
||||||
|
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.TABLE_GBACTIVITYSAMPLES;
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.TABLE_GBACTIVITYSAMPLES;
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.TABLE_STEPS_PER_DAY;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upgrade and downgrade with DB versions <= 5 is not supported.
|
* Upgrade and downgrade with DB versions <= 5 is not supported.
|
||||||
|
|
|
@ -5,7 +5,10 @@ import android.database.sqlite.SQLiteDatabase;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBUpdateScript;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBUpdateScript;
|
||||||
|
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.*;
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_PROVIDER;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_STEPS;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_TIMESTAMP;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.TABLE_STEPS_PER_DAY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a table "STEPS_PER_DAY".
|
* Adds a table "STEPS_PER_DAY".
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.AppManagerActivity;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.DeviceCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.DeviceCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.DeviceType;
|
import nodomain.freeyourgadget.gadgetbridge.DeviceType;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
|
|
|
@ -66,14 +66,15 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
//index of the buffer above
|
//index of the buffer above
|
||||||
public int activityDataHolderProgress = 0;
|
public int activityDataHolderProgress = 0;
|
||||||
//number of bytes we will get in a single data transfer, used as counter
|
//number of bytes we will get in a single data transfer, used as counter
|
||||||
public int activityDataRemainingBytes = 0;
|
public int activityDataRemainingBytes = 0;
|
||||||
//same as above, but remains untouched for the ack message
|
//same as above, but remains untouched for the ack message
|
||||||
public int activityDataUntilNextHeader = 0;
|
public int activityDataUntilNextHeader = 0;
|
||||||
//timestamp of the single data transfer, incremented to store each minute's data
|
//timestamp of the single data transfer, incremented to store each minute's data
|
||||||
public GregorianCalendar activityDataTimestampProgress = null;
|
public GregorianCalendar activityDataTimestampProgress = null;
|
||||||
//same as above, but remains untouched for the ack message
|
//same as above, but remains untouched for the ack message
|
||||||
public GregorianCalendar activityDataTimestampToAck = null;
|
public GregorianCalendar activityDataTimestampToAck = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MiBandSupport.class);
|
private static final Logger LOG = LoggerFactory.getLogger(MiBandSupport.class);
|
||||||
private volatile boolean telephoneRinging;
|
private volatile boolean telephoneRinging;
|
||||||
private volatile boolean isLocatingDevice;
|
private volatile boolean isLocatingDevice;
|
||||||
|
@ -503,18 +504,18 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
|
|
||||||
private byte[] getLatency(int minConnectionInterval, int maxConnectionInterval, int latency, int timeout, int advertisementInterval) {
|
private byte[] getLatency(int minConnectionInterval, int maxConnectionInterval, int latency, int timeout, int advertisementInterval) {
|
||||||
byte result[] = new byte[12];
|
byte result[] = new byte[12];
|
||||||
result[0] = (byte)(minConnectionInterval & 0xff);
|
result[0] = (byte) (minConnectionInterval & 0xff);
|
||||||
result[1] = (byte)(0xff & minConnectionInterval >> 8);
|
result[1] = (byte) (0xff & minConnectionInterval >> 8);
|
||||||
result[2] = (byte)(maxConnectionInterval & 0xff);
|
result[2] = (byte) (maxConnectionInterval & 0xff);
|
||||||
result[3] = (byte) (0xff & maxConnectionInterval >> 8);
|
result[3] = (byte) (0xff & maxConnectionInterval >> 8);
|
||||||
result[4] = (byte)(latency & 0xff);
|
result[4] = (byte) (latency & 0xff);
|
||||||
result[5] = (byte)(0xff & latency >> 8);
|
result[5] = (byte) (0xff & latency >> 8);
|
||||||
result[6] = (byte)(timeout & 0xff);
|
result[6] = (byte) (timeout & 0xff);
|
||||||
result[7] = (byte) (0xff & timeout >> 8);
|
result[7] = (byte) (0xff & timeout >> 8);
|
||||||
result[8] = 0;
|
result[8] = 0;
|
||||||
result[9] = 0;
|
result[9] = 0;
|
||||||
result[10] = (byte)(advertisementInterval & 0xff);
|
result[10] = (byte) (advertisementInterval & 0xff);
|
||||||
result[11] = (byte)(0xff & advertisementInterval >> 8);
|
result[11] = (byte) (0xff & advertisementInterval >> 8);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -780,7 +781,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
||||||
|
|
||||||
//The last data chunk sent by the miband has always length 0.
|
//The last data chunk sent by the miband has always length 0.
|
||||||
//When we ack this chunk, the transfer is done.
|
//When we ack this chunk, the transfer is done.
|
||||||
if(getDevice().isBusy() && bytesTransferred==0) {
|
if (getDevice().isBusy() && bytesTransferred == 0) {
|
||||||
handleActivityFetchFinish();
|
handleActivityFetchFinish();
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class GadgetbridgePblSupport {
|
||||||
break;
|
break;
|
||||||
case KEY_SAMPLES:
|
case KEY_SAMPLES:
|
||||||
byte[] samples = (byte[]) pair.second;
|
byte[] samples = (byte[]) pair.second;
|
||||||
LOG.info("got " + samples.length/2 + " samples");
|
LOG.info("got " + samples.length / 2 + " samples");
|
||||||
ByteBuffer samplesBuffer = ByteBuffer.wrap(samples);
|
ByteBuffer samplesBuffer = ByteBuffer.wrap(samples);
|
||||||
// TODO: read samples and put into database
|
// TODO: read samples and put into database
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11,6 +11,7 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
public class FileUtils {
|
public class FileUtils {
|
||||||
/**
|
/**
|
||||||
* Copies the the given sourceFile to destFile, overwriting it, in case it exists.
|
* Copies the the given sourceFile to destFile, overwriting it, in case it exists.
|
||||||
|
*
|
||||||
* @param sourceFile
|
* @param sourceFile
|
||||||
* @param destFile
|
* @param destFile
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
@ -30,6 +31,7 @@ public class FileUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the existing external storage dir.
|
* Returns the existing external storage dir.
|
||||||
|
*
|
||||||
* @throws IOException when the directory is not available
|
* @throws IOException when the directory is not available
|
||||||
*/
|
*/
|
||||||
public static File getExternalFilesDir() throws IOException {
|
public static File getExternalFilesDir() throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue