Added watch data to system fragment on main display, including watch signal strength
This commit is contained in:
@@ -174,6 +174,20 @@ public class FragmentSystem extends FragmentOsdBaseClass {
|
||||
tv.setBackgroundColor(okColour);
|
||||
tv.setTextColor(okTextColour);
|
||||
}
|
||||
tv = (TextView) mRootView.findViewById(R.id.watch_manuf_tv);
|
||||
tv.setText(mConnection.mSdServer.mSdData.watchManuf);
|
||||
tv = (TextView) mRootView.findViewById(R.id.watch_partno_tv);
|
||||
tv.setText(mConnection.mSdServer.mSdData.watchPartNo);
|
||||
tv = (TextView) mRootView.findViewById(R.id.watch_fwver_tv);
|
||||
tv.setText(mConnection.mSdServer.mSdData.watchFwVersion);
|
||||
tv = (TextView) mRootView.findViewById(R.id.watch_sdname_tv);
|
||||
tv.setText(mConnection.mSdServer.mSdData.watchSdName);
|
||||
tv = (TextView) mRootView.findViewById(R.id.watch_sdver_tv);
|
||||
tv.setText(mConnection.mSdServer.mSdData.watchSdVersion);
|
||||
tv = (TextView) mRootView.findViewById(R.id.watch_batt_tv);
|
||||
tv.setText(mConnection.mSdServer.mSdData.batteryPc+" %");
|
||||
tv = (TextView) mRootView.findViewById(R.id.watch_signal_tv);
|
||||
tv.setText(String.format("%.0f dB", mConnection.mSdServer.mSdData.watchSignalStrength));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "UpdateUi: Exception - ");
|
||||
|
||||
@@ -136,6 +136,7 @@ public class SdData implements Parcelable {
|
||||
public double mO2Sat = 0;
|
||||
|
||||
public double mPseizure = 0.;
|
||||
public float watchSignalStrength;
|
||||
|
||||
public SdData() {
|
||||
simpleSpec = new int[10];
|
||||
@@ -322,6 +323,7 @@ public class SdData implements Parcelable {
|
||||
jsonObj.put("watchSdName", watchSdName);
|
||||
jsonObj.put("watchFwVersion", watchFwVersion);
|
||||
jsonObj.put("watchSdVersion", watchSdVersion);
|
||||
jsonObj.put("watchSignalStrength", watchSignalStrength);
|
||||
|
||||
retval = jsonObj.toString();
|
||||
} catch (Exception ex) {
|
||||
|
||||
@@ -231,6 +231,8 @@ public class SdDataSourceBLE2 extends SdDataSource {
|
||||
peripheral.setPreferredPhy(PhyType.LE_CODED, PhyType.LE_CODED, PhyOptions.S8);
|
||||
peripheral.readPhy();
|
||||
|
||||
peripheral.readRemoteRssi();
|
||||
|
||||
boolean foundOsdService = false;
|
||||
for (BluetoothGattService service : peripheral.getServices()) {
|
||||
String servUuidStr = service.getUuid().toString();
|
||||
@@ -420,6 +422,7 @@ public class SdDataSourceBLE2 extends SdDataSource {
|
||||
mDataStatusTime = new Time(Time.getCurrentTimezone());
|
||||
// Process the data to do seizure detection
|
||||
doAnalysis();
|
||||
mBlePeripheral.readRemoteRssi(); // Update RSSI
|
||||
// Re-start collecting raw data.
|
||||
nRawData = 0;
|
||||
// Notify the device of the resulting alarm state
|
||||
@@ -490,6 +493,12 @@ public class SdDataSourceBLE2 extends SdDataSource {
|
||||
Log.i(TAG, String.format("new MTU set: %d", mtu));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReadRemoteRssi(@NotNull BluetoothPeripheral peripheral, int rssi, @NotNull GattStatus status) {
|
||||
Log.d(TAG, String.format("Rssi = %d", rssi));
|
||||
mSdData.watchSignalStrength = rssi;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -64,11 +64,6 @@
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fragment_watch_app_status_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/battTv"
|
||||
@@ -89,6 +84,140 @@
|
||||
android:gravity="left"
|
||||
android:text="---" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Watch Status"
|
||||
android:textColor="@color/okTextColor"
|
||||
android:background="@color/okBackgroundColor"
|
||||
/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/okTextColor"
|
||||
android:text="Watch Manufacturer: "/>
|
||||
<TextView
|
||||
android:id="@+id/watch_manuf_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/okTextColor"
|
||||
android:text="Watch Part No: "/>
|
||||
<TextView
|
||||
android:id="@+id/watch_partno_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/okTextColor"
|
||||
android:text="Watch FW Ver: "/>
|
||||
<TextView
|
||||
android:id="@+id/watch_fwver_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/okTextColor"
|
||||
android:text="Watch App Name: "/>
|
||||
<TextView
|
||||
android:id="@+id/watch_sdname_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/okTextColor"
|
||||
android:text="Watch App Ver: "/>
|
||||
<TextView
|
||||
android:id="@+id/watch_sdver_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fragment_watch_app_status_tv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/okTextColor"
|
||||
android:text="Watch Battery Level: "/>
|
||||
<TextView
|
||||
android:id="@+id/watch_batt_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/okTextColor"
|
||||
android:text="Watch Signal Strength: "/>
|
||||
<TextView
|
||||
android:id="@+id/watch_signal_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="---"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user