Set watch SD name and part no. for BLE data source

This commit is contained in:
Graham Jones
2024-01-21 19:47:23 +00:00
parent 36582f07e3
commit c5735d68c8
2 changed files with 9 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:versionCode="128" android:versionCode="128"
android:versionName="4.2.1m"> android:versionName="4.2.1n">
<!-- android:allowBackup="false" --> <!-- android:allowBackup="false" -->
<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

View File

@@ -124,9 +124,6 @@ public class SdDataSourceBLE extends SdDataSource {
SdDataReceiver sdDataReceiver) { SdDataReceiver sdDataReceiver) {
super(context, handler, sdDataReceiver); super(context, handler, sdDataReceiver);
mName = "BLE"; mName = "BLE";
// Set default settings from XML files (mContext is set by super().
PreferenceManager.setDefaultValues(mContext,
R.xml.network_passive_datasource_prefs, true);
} }
@@ -135,8 +132,8 @@ public class SdDataSourceBLE extends SdDataSource {
* make sure any changes to preferences are taken into account. * make sure any changes to preferences are taken into account.
*/ */
public void start() { public void start() {
Log.i(TAG, "start()");
super.start(); super.start();
Log.i(TAG, "start() - mBleDeviceAddr="+mBleDeviceAddr);
mUtil.writeToSysLogFile("SdDataSourceBLE.start() - mBleDeviceAddr=" + mBleDeviceAddr); mUtil.writeToSysLogFile("SdDataSourceBLE.start() - mBleDeviceAddr=" + mBleDeviceAddr);
if (mBleDeviceAddr == "" || mBleDeviceAddr == null) { if (mBleDeviceAddr == "" || mBleDeviceAddr == null) {
@@ -144,7 +141,14 @@ public class SdDataSourceBLE extends SdDataSource {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent); mContext.startActivity(intent);
} }
// Note, these values are set in BleScanActivity and written to shared preferences, which
// ae read in SdDataSource.java
// 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); Log.i(TAG, "mBLEDevice is " + mBleDeviceName + ", Addr=" + mBleDeviceAddr);
mSdData.watchSdName = mBleDeviceName;
mSdData.watchPartNo = mBleDeviceAddr;
bleConnect(); bleConnect();