Fixed minor data time period and BLE device MAC address display issues
This commit is contained in:
@@ -193,10 +193,11 @@ public class FragmentCommon extends FragmentOsdBaseClass {
|
||||
tv.setText(getString(R.string.DataSource) + " = " + "Phone (Demo Mode)");
|
||||
tv.setBackgroundColor(warnColour);
|
||||
tv.setTextColor(warnTextColour);
|
||||
} else if (mConnection.mSdServer.mSdDataSourceName.equals("BLE")) {
|
||||
} else if (mConnection.mSdServer.mSdDataSourceName.equals("BLE")
|
||||
|| mConnection.mSdServer.mSdDataSourceName.equals("BLE2")) {
|
||||
tv.setText(getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName
|
||||
+ " ("+ mConnection.mSdServer.mSdData.watchSdName + ", "
|
||||
+ mConnection.mSdServer.mSdData.watchPartNo+")");
|
||||
+ mConnection.mSdServer.mSdData.watchSerNo+")");
|
||||
} else {
|
||||
tv.setText(getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName);
|
||||
}
|
||||
|
||||
@@ -144,6 +144,7 @@ public class SdData implements Parcelable {
|
||||
rawData = new double[N_RAW_DATA];
|
||||
rawData3D = new double[N_RAW_DATA * 3];
|
||||
dataTime = new Time(Time.getCurrentTimezone());
|
||||
dataTime.setToNow();
|
||||
timeDiff = 0f;
|
||||
}
|
||||
|
||||
@@ -164,8 +165,12 @@ public class SdData implements Parcelable {
|
||||
// FIXME - this doesn't work!!!
|
||||
Time tnow = new Time();
|
||||
tnow.setToNow();
|
||||
timeDiff = (tnow.toMillis(false)
|
||||
- dataTime.toMillis(false))/1000f;
|
||||
if (dataTime != null) {
|
||||
timeDiff = (tnow.toMillis(false)
|
||||
- dataTime.toMillis(false)) / 1000f;
|
||||
} else {
|
||||
timeDiff = 0f;
|
||||
}
|
||||
dataTime.setToNow();
|
||||
Log.v(TAG, "fromJSON(): dataTime = " + dataTime.toString());
|
||||
maxVal = jo.optInt("maxVal");
|
||||
|
||||
@@ -538,8 +538,12 @@ public abstract class SdDataSource {
|
||||
mSdData.roiPower = (long) roiPower / ACCEL_SCALE_FACTOR;
|
||||
Time tnow = new Time();
|
||||
tnow.setToNow();
|
||||
mSdData.timeDiff = (tnow.toMillis(false)
|
||||
- mSdData.dataTime.toMillis(false))/1000f;
|
||||
if (mSdData.dataTime != null) {
|
||||
mSdData.timeDiff = (tnow.toMillis(false)
|
||||
- mSdData.dataTime.toMillis(false)) / 1000f;
|
||||
} else {
|
||||
mSdData.timeDiff = 0f;
|
||||
}
|
||||
mSdData.dataTime.setToNow();
|
||||
|
||||
mSdData.dataTime.setToNow();
|
||||
|
||||
@@ -153,8 +153,8 @@ public class SdDataSourceBLE2 extends SdDataSource {
|
||||
// FIXME: Read the shared preferences in this class so SdDataSource does not need to know
|
||||
// FIXME: about BLE details.
|
||||
Log.i(TAG, "mBLEDevice is " + mBleDeviceName + ", Addr=" + mBleDeviceAddr);
|
||||
mSdData.watchSdName = mBleDeviceName;
|
||||
mSdData.watchPartNo = mBleDeviceAddr;
|
||||
//mSdData.watchSdName = mBleDeviceName;
|
||||
mSdData.watchSerNo = mBleDeviceAddr;
|
||||
|
||||
boolean success = CurrentTimeService.startServer(mContext);
|
||||
|
||||
@@ -464,7 +464,8 @@ public class SdDataSourceBLE2 extends SdDataSource {
|
||||
byte[] rawDataBytes = characteristic.getValue();
|
||||
String watchSerNo = new String(rawDataBytes, StandardCharsets.UTF_8);
|
||||
Log.i(TAG, "Received Watch Serial No.: " + watchSerNo);
|
||||
mSdData.watchSerNo = watchSerNo;
|
||||
//mSdData.watchSerNo = watchSerNo;
|
||||
// We do not use this serial number because it is zero for PineTime - we set the MAC address at start-up instead.
|
||||
} else if (charUuidStr.equals(CHAR_DEV_HW_VER)) {
|
||||
byte[] rawDataBytes = characteristic.getValue();
|
||||
String watchHwVer = new String(rawDataBytes, StandardCharsets.UTF_8);
|
||||
|
||||
Reference in New Issue
Block a user