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.setText(getString(R.string.DataSource) + " = " + "Phone (Demo Mode)");
|
||||||
tv.setBackgroundColor(warnColour);
|
tv.setBackgroundColor(warnColour);
|
||||||
tv.setTextColor(warnTextColour);
|
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
|
tv.setText(getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName
|
||||||
+ " ("+ mConnection.mSdServer.mSdData.watchSdName + ", "
|
+ " ("+ mConnection.mSdServer.mSdData.watchSdName + ", "
|
||||||
+ mConnection.mSdServer.mSdData.watchPartNo+")");
|
+ mConnection.mSdServer.mSdData.watchSerNo+")");
|
||||||
} else {
|
} else {
|
||||||
tv.setText(getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName);
|
tv.setText(getString(R.string.DataSource) + " = " + mConnection.mSdServer.mSdDataSourceName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ public class SdData implements Parcelable {
|
|||||||
rawData = new double[N_RAW_DATA];
|
rawData = new double[N_RAW_DATA];
|
||||||
rawData3D = new double[N_RAW_DATA * 3];
|
rawData3D = new double[N_RAW_DATA * 3];
|
||||||
dataTime = new Time(Time.getCurrentTimezone());
|
dataTime = new Time(Time.getCurrentTimezone());
|
||||||
|
dataTime.setToNow();
|
||||||
timeDiff = 0f;
|
timeDiff = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,8 +165,12 @@ public class SdData implements Parcelable {
|
|||||||
// FIXME - this doesn't work!!!
|
// FIXME - this doesn't work!!!
|
||||||
Time tnow = new Time();
|
Time tnow = new Time();
|
||||||
tnow.setToNow();
|
tnow.setToNow();
|
||||||
|
if (dataTime != null) {
|
||||||
timeDiff = (tnow.toMillis(false)
|
timeDiff = (tnow.toMillis(false)
|
||||||
- dataTime.toMillis(false)) / 1000f;
|
- dataTime.toMillis(false)) / 1000f;
|
||||||
|
} else {
|
||||||
|
timeDiff = 0f;
|
||||||
|
}
|
||||||
dataTime.setToNow();
|
dataTime.setToNow();
|
||||||
Log.v(TAG, "fromJSON(): dataTime = " + dataTime.toString());
|
Log.v(TAG, "fromJSON(): dataTime = " + dataTime.toString());
|
||||||
maxVal = jo.optInt("maxVal");
|
maxVal = jo.optInt("maxVal");
|
||||||
|
|||||||
@@ -538,8 +538,12 @@ public abstract class SdDataSource {
|
|||||||
mSdData.roiPower = (long) roiPower / ACCEL_SCALE_FACTOR;
|
mSdData.roiPower = (long) roiPower / ACCEL_SCALE_FACTOR;
|
||||||
Time tnow = new Time();
|
Time tnow = new Time();
|
||||||
tnow.setToNow();
|
tnow.setToNow();
|
||||||
|
if (mSdData.dataTime != null) {
|
||||||
mSdData.timeDiff = (tnow.toMillis(false)
|
mSdData.timeDiff = (tnow.toMillis(false)
|
||||||
- mSdData.dataTime.toMillis(false)) / 1000f;
|
- mSdData.dataTime.toMillis(false)) / 1000f;
|
||||||
|
} else {
|
||||||
|
mSdData.timeDiff = 0f;
|
||||||
|
}
|
||||||
mSdData.dataTime.setToNow();
|
mSdData.dataTime.setToNow();
|
||||||
|
|
||||||
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: Read the shared preferences in this class so SdDataSource does not need to know
|
||||||
// FIXME: about BLE details.
|
// FIXME: about BLE details.
|
||||||
Log.i(TAG, "mBLEDevice is " + mBleDeviceName + ", Addr=" + mBleDeviceAddr);
|
Log.i(TAG, "mBLEDevice is " + mBleDeviceName + ", Addr=" + mBleDeviceAddr);
|
||||||
mSdData.watchSdName = mBleDeviceName;
|
//mSdData.watchSdName = mBleDeviceName;
|
||||||
mSdData.watchPartNo = mBleDeviceAddr;
|
mSdData.watchSerNo = mBleDeviceAddr;
|
||||||
|
|
||||||
boolean success = CurrentTimeService.startServer(mContext);
|
boolean success = CurrentTimeService.startServer(mContext);
|
||||||
|
|
||||||
@@ -464,7 +464,8 @@ public class SdDataSourceBLE2 extends SdDataSource {
|
|||||||
byte[] rawDataBytes = characteristic.getValue();
|
byte[] rawDataBytes = characteristic.getValue();
|
||||||
String watchSerNo = new String(rawDataBytes, StandardCharsets.UTF_8);
|
String watchSerNo = new String(rawDataBytes, StandardCharsets.UTF_8);
|
||||||
Log.i(TAG, "Received Watch Serial No.: " + watchSerNo);
|
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)) {
|
} else if (charUuidStr.equals(CHAR_DEV_HW_VER)) {
|
||||||
byte[] rawDataBytes = characteristic.getValue();
|
byte[] rawDataBytes = characteristic.getValue();
|
||||||
String watchHwVer = new String(rawDataBytes, StandardCharsets.UTF_8);
|
String watchHwVer = new String(rawDataBytes, StandardCharsets.UTF_8);
|
||||||
|
|||||||
Reference in New Issue
Block a user