mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-22 00:44:26 +01:00
Minor refactoring: S removed from class and packages names
This commit is contained in:
@@ -57,11 +57,11 @@ dependencies {
|
||||
|
||||
// Import the BLE Common Library.
|
||||
// The BLE Common Library depends on BLE Library. It is enough to include the first one.
|
||||
implementation 'no.nordicsemi.android:ble-common:2.2.0-alpha05'
|
||||
// implementation 'no.nordicsemi.android:ble-common:2.2.0-alpha05'
|
||||
// The BLE Common Library may be included from jcenter. If you want to modify the code,
|
||||
// clone both projects from GitHub and replace the line above with the following
|
||||
// (and also the according lines in the settings.gradle):
|
||||
// implementation project(':ble-common')
|
||||
implementation project(':ble-common')
|
||||
|
||||
implementation('org.simpleframework:simple-xml:2.7.1') {
|
||||
exclude group: 'stax', module: 'stax-api'
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
android:name="no.nordicsemi.android.nrftoolbox.dfu.NotificationActivity"
|
||||
android:label="@string/dfu_feature_title" />
|
||||
<activity
|
||||
android:name="no.nordicsemi.android.nrftoolbox.hrs.HRSActivity"
|
||||
android:name="no.nordicsemi.android.nrftoolbox.hr.HRActivity"
|
||||
android:icon="@drawable/ic_hrs_feature"
|
||||
android:label="@string/hrs_feature_title" >
|
||||
<intent-filter>
|
||||
@@ -129,7 +129,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="no.nordicsemi.android.nrftoolbox.hts.HTSActivity"
|
||||
android:name="no.nordicsemi.android.nrftoolbox.ht.HTActivity"
|
||||
android:icon="@drawable/ic_hts_feature"
|
||||
android:label="@string/hts_feature_title" >
|
||||
<intent-filter>
|
||||
@@ -139,7 +139,7 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="no.nordicsemi.android.nrftoolbox.hts.settings.SettingsActivity"
|
||||
android:name="no.nordicsemi.android.nrftoolbox.ht.settings.SettingsActivity"
|
||||
android:label="@string/hts_settings_title" />
|
||||
<activity
|
||||
android:name="no.nordicsemi.android.nrftoolbox.bpm.BPMActivity"
|
||||
@@ -212,7 +212,7 @@
|
||||
<category android:name="no.nordicsemi.android.nrftoolbox.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="no.nordicsemi.android.nrftoolbox.cgms.CGMSActivity"
|
||||
<activity android:name="no.nordicsemi.android.nrftoolbox.cgm.CGMSActivity"
|
||||
android:icon="@drawable/ic_cgms_feature"
|
||||
android:label="@string/cgms_feature_title"
|
||||
android:launchMode="singleTask">
|
||||
@@ -250,7 +250,7 @@
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name="no.nordicsemi.android.nrftoolbox.cgms.CGMService"
|
||||
android:name="no.nordicsemi.android.nrftoolbox.cgm.CGMService"
|
||||
android:label="@string/cgms_feature_title" />
|
||||
<service
|
||||
android:name="no.nordicsemi.android.nrftoolbox.rsc.RSCService"
|
||||
@@ -259,7 +259,7 @@
|
||||
android:name="no.nordicsemi.android.nrftoolbox.csc.CSCService"
|
||||
android:label="@string/csc_feature_title" />
|
||||
<service
|
||||
android:name="no.nordicsemi.android.nrftoolbox.hts.HTSService"
|
||||
android:name="no.nordicsemi.android.nrftoolbox.ht.HTService"
|
||||
android:label="@string/hts_feature_title" />
|
||||
<service
|
||||
android:name="no.nordicsemi.android.nrftoolbox.uart.UARTService"
|
||||
|
||||
@@ -52,7 +52,7 @@ import android.widget.Toast;
|
||||
import java.util.List;
|
||||
|
||||
import no.nordicsemi.android.nrftoolbox.adapter.AppAdapter;
|
||||
import no.nordicsemi.android.nrftoolbox.hrs.HRSActivity;
|
||||
import no.nordicsemi.android.nrftoolbox.hr.HRActivity;
|
||||
|
||||
public class FeaturesActivity extends AppCompatActivity {
|
||||
private static final String NRF_CONNECT_CATEGORY = "no.nordicsemi.android.nrftoolbox.LAUNCHER";
|
||||
@@ -108,7 +108,7 @@ public class FeaturesActivity extends AppCompatActivity {
|
||||
final String app = intent.getStringExtra(EXTRA_APP);
|
||||
switch (app) {
|
||||
case "HRM":
|
||||
final Intent newIntent = new Intent(this, HRSActivity.class);
|
||||
final Intent newIntent = new Intent(this, HRActivity.class);
|
||||
newIntent.putExtra(EXTRA_ADDRESS, intent.getByteArrayExtra(EXTRA_ADDRESS));
|
||||
newIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||
startActivity(newIntent);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package no.nordicsemi.android.nrftoolbox.cgms;
|
||||
package no.nordicsemi.android.nrftoolbox.cgm;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
@@ -49,7 +49,7 @@ import no.nordicsemi.android.nrftoolbox.parser.CGMMeasurementParser;
|
||||
import no.nordicsemi.android.nrftoolbox.parser.CGMSpecificOpsControlPointParser;
|
||||
import no.nordicsemi.android.nrftoolbox.parser.RecordAccessControlPointParser;
|
||||
|
||||
class CGMSManager extends BatteryManager<CGMSManagerCallbacks> {
|
||||
class CGMManager extends BatteryManager<CGMManagerCallbacks> {
|
||||
/** Cycling Speed and Cadence service UUID. */
|
||||
static final UUID CGMS_UUID = UUID.fromString("0000181F-0000-1000-8000-00805f9b34fb");
|
||||
private static final UUID CGM_STATUS_UUID = UUID.fromString("00002AA9-0000-1000-8000-00805f9b34fb");
|
||||
@@ -65,7 +65,7 @@ class CGMSManager extends BatteryManager<CGMSManagerCallbacks> {
|
||||
private BluetoothGattCharacteristic cgmSpecificOpsControlPointCharacteristic;
|
||||
private BluetoothGattCharacteristic recordAccessControlPointCharacteristic;
|
||||
|
||||
private SparseArray<CGMSRecord> records = new SparseArray<>();
|
||||
private SparseArray<CGMRecord> records = new SparseArray<>();
|
||||
|
||||
/** A flag set to true if the remote device supports E2E CRC. */
|
||||
private boolean secured;
|
||||
@@ -80,7 +80,7 @@ class CGMSManager extends BatteryManager<CGMSManagerCallbacks> {
|
||||
*/
|
||||
private long sessionStartTime;
|
||||
|
||||
CGMSManager(final Context context) {
|
||||
CGMManager(final Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ class CGMSManager extends BatteryManager<CGMSManagerCallbacks> {
|
||||
@Override
|
||||
public void onContinuousGlucoseMonitorFeaturesReceived(@NonNull final BluetoothDevice device, @NonNull final CGMFeatures features,
|
||||
final int type, final int sampleLocation, final boolean secured) {
|
||||
CGMSManager.this.secured = features.e2eCrcSupported;
|
||||
log(LogContract.Log.Level.APPLICATION, "E2E CRC feature " + (CGMSManager.this.secured ? "supported" : "not supported"));
|
||||
CGMManager.this.secured = features.e2eCrcSupported;
|
||||
log(LogContract.Log.Level.APPLICATION, "E2E CRC feature " + (CGMManager.this.secured ? "supported" : "not supported"));
|
||||
}
|
||||
})
|
||||
.fail((device, status) -> log(Log.WARN, "Could not read CGM Feature characteristic"))
|
||||
@@ -155,7 +155,7 @@ class CGMSManager extends BatteryManager<CGMSManagerCallbacks> {
|
||||
// Calculate the sample timestamp based on the Session Start Time
|
||||
final long timestamp = sessionStartTime + (timeOffset * 60000L); // Sequence number is in minutes since Start Session
|
||||
|
||||
final CGMSRecord record = new CGMSRecord(timeOffset, glucoseConcentration, timestamp);
|
||||
final CGMRecord record = new CGMRecord(timeOffset, glucoseConcentration, timestamp);
|
||||
records.put(record.sequenceNumber, record);
|
||||
callbacks.onCGMValueReceived(device, record);
|
||||
}
|
||||
@@ -332,7 +332,7 @@ class CGMSManager extends BatteryManager<CGMSManagerCallbacks> {
|
||||
/**
|
||||
* Returns a list of CGM records obtained from this device. The key in the array is the
|
||||
*/
|
||||
SparseArray<CGMSRecord> getRecords() {
|
||||
SparseArray<CGMRecord> getRecords() {
|
||||
return records;
|
||||
}
|
||||
|
||||
@@ -20,16 +20,16 @@
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package no.nordicsemi.android.nrftoolbox.cgms;
|
||||
package no.nordicsemi.android.nrftoolbox.cgm;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import no.nordicsemi.android.nrftoolbox.battery.BatteryManagerCallbacks;
|
||||
|
||||
interface CGMSManagerCallbacks extends BatteryManagerCallbacks {
|
||||
interface CGMManagerCallbacks extends BatteryManagerCallbacks {
|
||||
|
||||
void onCGMValueReceived(@NonNull final BluetoothDevice device, @NonNull final CGMSRecord record);
|
||||
void onCGMValueReceived(@NonNull final BluetoothDevice device, @NonNull final CGMRecord record);
|
||||
|
||||
void onOperationStarted(final @NonNull BluetoothDevice device);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package no.nordicsemi.android.nrftoolbox.cgms;
|
||||
package no.nordicsemi.android.nrftoolbox.cgm;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
class CGMSRecord implements Parcelable{
|
||||
class CGMRecord implements Parcelable{
|
||||
/** Record sequence number. */
|
||||
int sequenceNumber;
|
||||
/** The base time of the measurement (start time + sequenceNumber of minutes). */
|
||||
@@ -11,27 +11,27 @@ class CGMSRecord implements Parcelable{
|
||||
/** The glucose concentration in mg/dL. */
|
||||
float glucoseConcentration;
|
||||
|
||||
CGMSRecord(final int sequenceNumber, final float glucoseConcentration, final long timestamp) {
|
||||
CGMRecord(final int sequenceNumber, final float glucoseConcentration, final long timestamp) {
|
||||
this.sequenceNumber = sequenceNumber;
|
||||
this.glucoseConcentration = glucoseConcentration;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
private CGMSRecord(final Parcel in) {
|
||||
private CGMRecord(final Parcel in) {
|
||||
this.sequenceNumber = in.readInt();
|
||||
this.glucoseConcentration = in.readFloat();
|
||||
this.timestamp = in.readLong();
|
||||
}
|
||||
|
||||
public static final Creator<CGMSRecord> CREATOR = new Creator<CGMSRecord>() {
|
||||
public static final Creator<CGMRecord> CREATOR = new Creator<CGMRecord>() {
|
||||
@Override
|
||||
public CGMSRecord createFromParcel(final Parcel in) {
|
||||
return new CGMSRecord(in);
|
||||
public CGMRecord createFromParcel(final Parcel in) {
|
||||
return new CGMRecord(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CGMSRecord[] newArray(final int size) {
|
||||
return new CGMSRecord[size];
|
||||
public CGMRecord[] newArray(final int size) {
|
||||
return new CGMRecord[size];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package no.nordicsemi.android.nrftoolbox.cgms;
|
||||
package no.nordicsemi.android.nrftoolbox.cgm;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -17,13 +17,13 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import no.nordicsemi.android.nrftoolbox.R;
|
||||
|
||||
class CGMSRecordsAdapter extends BaseAdapter {
|
||||
class CGMRecordsAdapter extends BaseAdapter {
|
||||
private final static SimpleDateFormat timeFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm", Locale.US);
|
||||
|
||||
private List<CGMSRecord> records;
|
||||
private List<CGMRecord> records;
|
||||
private LayoutInflater inflater;
|
||||
|
||||
CGMSRecordsAdapter(@NonNull final Context context) {
|
||||
CGMRecordsAdapter(@NonNull final Context context) {
|
||||
records = new ArrayList<>();
|
||||
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
}
|
||||
@@ -58,15 +58,15 @@ class CGMSRecordsAdapter extends BaseAdapter {
|
||||
viewHolder = (ViewHolder) view.getTag();
|
||||
}
|
||||
|
||||
final CGMSRecord cgmsRecord = records.get(position);
|
||||
viewHolder.concentration.setText(String.valueOf(cgmsRecord.glucoseConcentration));
|
||||
viewHolder.details.setText(viewHolder.details.getResources().getString(R.string.cgms_details, cgmsRecord.sequenceNumber));
|
||||
viewHolder.time.setText(timeFormat.format(new Date(cgmsRecord.timestamp)));
|
||||
final CGMRecord CGMRecord = records.get(position);
|
||||
viewHolder.concentration.setText(String.valueOf(CGMRecord.glucoseConcentration));
|
||||
viewHolder.details.setText(viewHolder.details.getResources().getString(R.string.cgms_details, CGMRecord.sequenceNumber));
|
||||
viewHolder.time.setText(timeFormat.format(new Date(CGMRecord.timestamp)));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
void addItem(final CGMSRecord record) {
|
||||
void addItem(final CGMRecord record) {
|
||||
records.add(record);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package no.nordicsemi.android.nrftoolbox.cgms;
|
||||
package no.nordicsemi.android.nrftoolbox.cgm;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -51,7 +51,7 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
|
||||
private View controlPanelAbort;
|
||||
private ListView recordsListView;
|
||||
private TextView batteryLevelView;
|
||||
private CGMSRecordsAdapter cgmsRecordsAdapter;
|
||||
private CGMRecordsAdapter CGMRecordsAdapter;
|
||||
|
||||
private CGMService.CGMSBinder binder;
|
||||
|
||||
@@ -102,12 +102,12 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
|
||||
});
|
||||
}
|
||||
|
||||
private void loadAdapter(SparseArray<CGMSRecord> records) {
|
||||
cgmsRecordsAdapter.clear();
|
||||
private void loadAdapter(SparseArray<CGMRecord> records) {
|
||||
CGMRecordsAdapter.clear();
|
||||
for (int i = 0; i < records.size(); i++) {
|
||||
cgmsRecordsAdapter.addItem(records.valueAt(i));
|
||||
CGMRecordsAdapter.addItem(records.valueAt(i));
|
||||
}
|
||||
cgmsRecordsAdapter.notifyDataSetChanged();
|
||||
CGMRecordsAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,11 +119,11 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
|
||||
@Override
|
||||
protected void onServiceBound(final CGMService.CGMSBinder binder) {
|
||||
this.binder = binder;
|
||||
final SparseArray<CGMSRecord> cgmsRecords = binder.getRecords();
|
||||
final SparseArray<CGMRecord> cgmsRecords = binder.getRecords();
|
||||
if (cgmsRecords != null && cgmsRecords.size() > 0) {
|
||||
if (cgmsRecordsAdapter == null) {
|
||||
cgmsRecordsAdapter = new CGMSRecordsAdapter(CGMSActivity.this);
|
||||
recordsListView.setAdapter(cgmsRecordsAdapter);
|
||||
if (CGMRecordsAdapter == null) {
|
||||
CGMRecordsAdapter = new CGMRecordsAdapter(CGMSActivity.this);
|
||||
recordsListView.setAdapter(CGMRecordsAdapter);
|
||||
}
|
||||
loadAdapter(cgmsRecords);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
|
||||
|
||||
@Override
|
||||
protected UUID getFilterUUID() {
|
||||
return CGMSManager.CGMS_UUID;
|
||||
return CGMManager.CGMS_UUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -219,9 +219,9 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
|
||||
}
|
||||
|
||||
private void clearRecords() {
|
||||
if (cgmsRecordsAdapter != null) {
|
||||
cgmsRecordsAdapter.clear();
|
||||
cgmsRecordsAdapter.notifyDataSetChanged();
|
||||
if (CGMRecordsAdapter != null) {
|
||||
CGMRecordsAdapter.clear();
|
||||
CGMRecordsAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,13 +233,13 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
|
||||
|
||||
switch (action) {
|
||||
case CGMService.BROADCAST_NEW_CGMS_VALUE: {
|
||||
CGMSRecord cgmsRecord = intent.getExtras().getParcelable(CGMService.EXTRA_CGMS_RECORD);
|
||||
if (cgmsRecordsAdapter == null) {
|
||||
cgmsRecordsAdapter = new CGMSRecordsAdapter(CGMSActivity.this);
|
||||
recordsListView.setAdapter(cgmsRecordsAdapter);
|
||||
CGMRecord CGMRecord = intent.getExtras().getParcelable(CGMService.EXTRA_CGMS_RECORD);
|
||||
if (CGMRecordsAdapter == null) {
|
||||
CGMRecordsAdapter = new CGMRecordsAdapter(CGMSActivity.this);
|
||||
recordsListView.setAdapter(CGMRecordsAdapter);
|
||||
}
|
||||
cgmsRecordsAdapter.addItem(cgmsRecord);
|
||||
cgmsRecordsAdapter.notifyDataSetChanged();
|
||||
CGMRecordsAdapter.addItem(CGMRecord);
|
||||
CGMRecordsAdapter.notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
case CGMService.BROADCAST_DATA_SET_CLEAR:
|
||||
@@ -1,4 +1,4 @@
|
||||
package no.nordicsemi.android.nrftoolbox.cgms;
|
||||
package no.nordicsemi.android.nrftoolbox.cgm;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
@@ -21,7 +21,7 @@ import no.nordicsemi.android.nrftoolbox.ToolboxApplication;
|
||||
import no.nordicsemi.android.nrftoolbox.profile.BleProfileService;
|
||||
import no.nordicsemi.android.nrftoolbox.profile.LoggableBleManager;
|
||||
|
||||
public class CGMService extends BleProfileService implements CGMSManagerCallbacks {
|
||||
public class CGMService extends BleProfileService implements CGMManagerCallbacks {
|
||||
private static final String ACTION_DISCONNECT = "no.nordicsemi.android.nrftoolbox.cgms.ACTION_DISCONNECT";
|
||||
|
||||
public static final String BROADCAST_BATTERY_LEVEL = "no.nordicsemi.android.nrftoolbox.BROADCAST_BATTERY_LEVEL";
|
||||
@@ -42,7 +42,7 @@ public class CGMService extends BleProfileService implements CGMSManagerCallback
|
||||
private final static int OPEN_ACTIVITY_REQ = 0;
|
||||
private final static int DISCONNECT_REQ = 1;
|
||||
|
||||
private CGMSManager manager;
|
||||
private CGMManager manager;
|
||||
private final LocalBinder binder = new CGMSBinder();
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ public class CGMService extends BleProfileService implements CGMSManagerCallback
|
||||
*
|
||||
* @return the records list
|
||||
*/
|
||||
SparseArray<CGMSRecord> getRecords() {
|
||||
SparseArray<CGMRecord> getRecords() {
|
||||
return manager.getRecords();
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class CGMService extends BleProfileService implements CGMSManagerCallback
|
||||
/**
|
||||
* Sends the request to obtain the first (oldest) record from glucose device.
|
||||
* The data will be returned to Glucose Measurement characteristic as a notification followed by Record Access Control
|
||||
* Point indication with status code ({@link CGMSManager# RESPONSE_SUCCESS} or other in case of error.
|
||||
* Point indication with status code ({@link CGMManager# RESPONSE_SUCCESS} or other in case of error.
|
||||
*/
|
||||
void getFirstRecord() {
|
||||
if (manager != null)
|
||||
@@ -132,8 +132,8 @@ public class CGMService extends BleProfileService implements CGMSManagerCallback
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LoggableBleManager<CGMSManagerCallbacks> initializeManager() {
|
||||
return manager = new CGMSManager(this);
|
||||
protected LoggableBleManager<CGMManagerCallbacks> initializeManager() {
|
||||
return manager = new CGMManager(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ public class CGMService extends BleProfileService implements CGMSManagerCallback
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCGMValueReceived(@NonNull final BluetoothDevice device, @NonNull final CGMSRecord record) {
|
||||
public void onCGMValueReceived(@NonNull final BluetoothDevice device, @NonNull final CGMRecord record) {
|
||||
final Intent broadcast = new Intent(BROADCAST_NEW_CGMS_VALUE);
|
||||
broadcast.putExtra(EXTRA_DEVICE, getBluetoothDevice());
|
||||
broadcast.putExtra(EXTRA_CGMS_RECORD, record);
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.nrftoolbox.hrs;
|
||||
package no.nordicsemi.android.nrftoolbox.hr;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
@@ -49,7 +49,7 @@ import no.nordicsemi.android.nrftoolbox.profile.LoggableBleManager;
|
||||
* uses external library AChartEngine to show real time graph of HR values.
|
||||
*/
|
||||
// TODO The HRSActivity should be rewritten to use the service approach, like other do.
|
||||
public class HRSActivity extends BleProfileActivity implements HRSManagerCallbacks {
|
||||
public class HRActivity extends BleProfileActivity implements HRManagerCallbacks {
|
||||
@SuppressWarnings("unused")
|
||||
private final String TAG = "HRSActivity";
|
||||
|
||||
@@ -151,7 +151,7 @@ public class HRSActivity extends BleProfileActivity implements HRSManagerCallbac
|
||||
|
||||
@Override
|
||||
protected UUID getFilterUUID() {
|
||||
return HRSManager.HR_SERVICE_UUID;
|
||||
return HRManager.HR_SERVICE_UUID;
|
||||
}
|
||||
|
||||
private void updateGraph(final int hrmValue) {
|
||||
@@ -181,8 +181,8 @@ public class HRSActivity extends BleProfileActivity implements HRSManagerCallbac
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LoggableBleManager<HRSManagerCallbacks> initializeManager() {
|
||||
final HRSManager manager = HRSManager.getInstance(getApplicationContext());
|
||||
protected LoggableBleManager<HRManagerCallbacks> initializeManager() {
|
||||
final HRManager manager = HRManager.getInstance(getApplicationContext());
|
||||
manager.setManagerCallbacks(this);
|
||||
return manager;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.nrftoolbox.hrs;
|
||||
package no.nordicsemi.android.nrftoolbox.hr;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothGatt;
|
||||
@@ -50,26 +50,26 @@ import no.nordicsemi.android.nrftoolbox.parser.HeartRateMeasurementParser;
|
||||
* All operations required to connect to device with BLE Heart Rate Service and reading
|
||||
* heart rate values are performed here.
|
||||
*/
|
||||
public class HRSManager extends BatteryManager<HRSManagerCallbacks> {
|
||||
public class HRManager extends BatteryManager<HRManagerCallbacks> {
|
||||
static final UUID HR_SERVICE_UUID = UUID.fromString("0000180D-0000-1000-8000-00805f9b34fb");
|
||||
private static final UUID BODY_SENSOR_LOCATION_CHARACTERISTIC_UUID = UUID.fromString("00002A38-0000-1000-8000-00805f9b34fb");
|
||||
private static final UUID HEART_RATE_MEASUREMENT_CHARACTERISTIC_UUID = UUID.fromString("00002A37-0000-1000-8000-00805f9b34fb");
|
||||
|
||||
private BluetoothGattCharacteristic heartRateCharacteristic, bodySensorLocationCharacteristic;
|
||||
|
||||
private static HRSManager managerInstance = null;
|
||||
private static HRManager managerInstance = null;
|
||||
|
||||
/**
|
||||
* Singleton implementation of HRSManager class.
|
||||
*/
|
||||
public static synchronized HRSManager getInstance(final Context context) {
|
||||
public static synchronized HRManager getInstance(final Context context) {
|
||||
if (managerInstance == null) {
|
||||
managerInstance = new HRSManager(context);
|
||||
managerInstance = new HRManager(context);
|
||||
}
|
||||
return managerInstance;
|
||||
}
|
||||
|
||||
private HRSManager(final Context context) {
|
||||
private HRManager(final Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.nrftoolbox.hrs;
|
||||
package no.nordicsemi.android.nrftoolbox.hr;
|
||||
|
||||
import no.nordicsemi.android.ble.common.profile.hr.BodySensorLocationCallback;
|
||||
import no.nordicsemi.android.ble.common.profile.hr.HeartRateMeasurementCallback;
|
||||
import no.nordicsemi.android.nrftoolbox.battery.BatteryManagerCallbacks;
|
||||
|
||||
interface HRSManagerCallbacks extends BatteryManagerCallbacks, BodySensorLocationCallback, HeartRateMeasurementCallback {
|
||||
interface HRManagerCallbacks extends BatteryManagerCallbacks, BodySensorLocationCallback, HeartRateMeasurementCallback {
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.nrftoolbox.hrs;
|
||||
package no.nordicsemi.android.nrftoolbox.hr;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.nrftoolbox.hts;
|
||||
package no.nordicsemi.android.nrftoolbox.ht;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -38,17 +38,17 @@ import android.widget.TextView;
|
||||
import java.util.UUID;
|
||||
|
||||
import no.nordicsemi.android.nrftoolbox.R;
|
||||
import no.nordicsemi.android.nrftoolbox.hts.settings.SettingsActivity;
|
||||
import no.nordicsemi.android.nrftoolbox.hts.settings.SettingsFragment;
|
||||
import no.nordicsemi.android.nrftoolbox.ht.settings.SettingsActivity;
|
||||
import no.nordicsemi.android.nrftoolbox.ht.settings.SettingsFragment;
|
||||
import no.nordicsemi.android.nrftoolbox.profile.BleProfileService;
|
||||
import no.nordicsemi.android.nrftoolbox.profile.BleProfileServiceReadyActivity;
|
||||
|
||||
/**
|
||||
* HTSActivity is the main Health Thermometer activity. It implements {@link HTSManagerCallbacks}
|
||||
* to receive callbacks from {@link HTSManager} class. The activity supports portrait and landscape
|
||||
* HTSActivity is the main Health Thermometer activity. It implements {@link HTManagerCallbacks}
|
||||
* to receive callbacks from {@link HTManager} class. The activity supports portrait and landscape
|
||||
* orientations.
|
||||
*/
|
||||
public class HTSActivity extends BleProfileServiceReadyActivity<HTSService.HTSBinder> {
|
||||
public class HTActivity extends BleProfileServiceReadyActivity<HTService.HTSBinder> {
|
||||
@SuppressWarnings("unused")
|
||||
private final String TAG = "HTSActivity";
|
||||
|
||||
@@ -111,7 +111,7 @@ public class HTSActivity extends BleProfileServiceReadyActivity<HTSService.HTSBi
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onServiceBound(final HTSService.HTSBinder binder) {
|
||||
protected void onServiceBound(final HTService.HTSBinder binder) {
|
||||
onTemperatureMeasurementReceived(binder.getTemperature());
|
||||
}
|
||||
|
||||
@@ -154,12 +154,12 @@ public class HTSActivity extends BleProfileServiceReadyActivity<HTSService.HTSBi
|
||||
|
||||
@Override
|
||||
protected UUID getFilterUUID() {
|
||||
return HTSManager.HT_SERVICE_UUID;
|
||||
return HTManager.HT_SERVICE_UUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BleProfileService> getServiceClass() {
|
||||
return HTSService.class;
|
||||
return HTService.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,12 +204,12 @@ public class HTSActivity extends BleProfileServiceReadyActivity<HTSService.HTSBi
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
|
||||
if (HTSService.BROADCAST_HTS_MEASUREMENT.equals(action)) {
|
||||
final float value = intent.getFloatExtra(HTSService.EXTRA_TEMPERATURE, 0.0f);
|
||||
if (HTService.BROADCAST_HTS_MEASUREMENT.equals(action)) {
|
||||
final float value = intent.getFloatExtra(HTService.EXTRA_TEMPERATURE, 0.0f);
|
||||
// Update GUI
|
||||
onTemperatureMeasurementReceived(value);
|
||||
} else if (HTSService.BROADCAST_BATTERY_LEVEL.equals(action)) {
|
||||
final int batteryLevel = intent.getIntExtra(HTSService.EXTRA_BATTERY_LEVEL, 0);
|
||||
} else if (HTService.BROADCAST_BATTERY_LEVEL.equals(action)) {
|
||||
final int batteryLevel = intent.getIntExtra(HTService.EXTRA_BATTERY_LEVEL, 0);
|
||||
// Update GUI
|
||||
onBatteryLevelChanged(batteryLevel);
|
||||
}
|
||||
@@ -218,8 +218,8 @@ public class HTSActivity extends BleProfileServiceReadyActivity<HTSService.HTSBi
|
||||
|
||||
private static IntentFilter makeIntentFilter() {
|
||||
final IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction(HTSService.BROADCAST_HTS_MEASUREMENT);
|
||||
intentFilter.addAction(HTSService.BROADCAST_BATTERY_LEVEL);
|
||||
intentFilter.addAction(HTService.BROADCAST_HTS_MEASUREMENT);
|
||||
intentFilter.addAction(HTService.BROADCAST_BATTERY_LEVEL);
|
||||
return intentFilter;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.nrftoolbox.hts;
|
||||
package no.nordicsemi.android.nrftoolbox.ht;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothGatt;
|
||||
@@ -41,12 +41,13 @@ import no.nordicsemi.android.nrftoolbox.battery.BatteryManager;
|
||||
import no.nordicsemi.android.nrftoolbox.parser.TemperatureMeasurementParser;
|
||||
|
||||
/**
|
||||
* HTSManager class performs BluetoothGatt operations for connection, service discovery, enabling
|
||||
* indication and reading characteristics. All operations required to connect to device with BLE HT
|
||||
* Service and reading health thermometer values are performed here.
|
||||
* HTSActivity implements HTSManagerCallbacks in order to receive callbacks of BluetoothGatt operations.
|
||||
* {@link HTManager} class performs {@link BluetoothGatt} operations for connection, service discovery,
|
||||
* enabling indication and reading characteristics. All operations required to connect to device
|
||||
* with BLE HT Service and reading health thermometer values are performed here.
|
||||
* {@link HTActivity} implements {@link HTManagerCallbacks} in order to receive callbacks of
|
||||
* {@link BluetoothGatt} operations.
|
||||
*/
|
||||
public class HTSManager extends BatteryManager<HTSManagerCallbacks> {
|
||||
public class HTManager extends BatteryManager<HTManagerCallbacks> {
|
||||
/** Health Thermometer service UUID */
|
||||
final static UUID HT_SERVICE_UUID = UUID.fromString("00001809-0000-1000-8000-00805f9b34fb");
|
||||
/** Health Thermometer Measurement characteristic UUID */
|
||||
@@ -54,7 +55,7 @@ public class HTSManager extends BatteryManager<HTSManagerCallbacks> {
|
||||
|
||||
private BluetoothGattCharacteristic htCharacteristic;
|
||||
|
||||
HTSManager(final Context context) {
|
||||
HTManager(final Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@@ -82,7 +83,8 @@ public class HTSManager extends BatteryManager<HTSManagerCallbacks> {
|
||||
|
||||
@Override
|
||||
public void onTemperatureMeasurementReceived(@NonNull final BluetoothDevice device,
|
||||
final float temperature, @TemperatureUnit final int unit,
|
||||
final float temperature,
|
||||
@TemperatureUnit final int unit,
|
||||
@Nullable final Calendar calendar,
|
||||
@Nullable @TemperatureType final Integer type) {
|
||||
callbacks.onTemperatureMeasurementReceived(device, temperature, unit, calendar, type);
|
||||
@@ -19,15 +19,15 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package no.nordicsemi.android.nrftoolbox.hts;
|
||||
package no.nordicsemi.android.nrftoolbox.ht;
|
||||
|
||||
import no.nordicsemi.android.ble.common.profile.ht.TemperatureMeasurementCallback;
|
||||
import no.nordicsemi.android.nrftoolbox.battery.BatteryManagerCallbacks;
|
||||
|
||||
/**
|
||||
* Interface {@link HTSManagerCallbacks} must be implemented by {@link HTSActivity} in order
|
||||
* to receive callbacks from {@link HTSManager}.
|
||||
* Interface {@link HTManagerCallbacks} must be implemented by {@link HTActivity} in order
|
||||
* to receive callbacks from {@link HTManager}.
|
||||
*/
|
||||
interface HTSManagerCallbacks extends BatteryManagerCallbacks, TemperatureMeasurementCallback {
|
||||
interface HTManagerCallbacks extends BatteryManagerCallbacks, TemperatureMeasurementCallback {
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package no.nordicsemi.android.nrftoolbox.hts;
|
||||
package no.nordicsemi.android.nrftoolbox.ht;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
@@ -50,7 +50,7 @@ import no.nordicsemi.android.nrftoolbox.profile.BleProfileService;
|
||||
import no.nordicsemi.android.nrftoolbox.profile.LoggableBleManager;
|
||||
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
public class HTSService extends BleProfileService implements HTSManagerCallbacks {
|
||||
public class HTService extends BleProfileService implements HTManagerCallbacks {
|
||||
public static final String BROADCAST_HTS_MEASUREMENT = "no.nordicsemi.android.nrftoolbox.hts.BROADCAST_HTS_MEASUREMENT";
|
||||
public static final String EXTRA_TEMPERATURE = "no.nordicsemi.android.nrftoolbox.hts.EXTRA_TEMPERATURE";
|
||||
|
||||
@@ -66,7 +66,7 @@ public class HTSService extends BleProfileService implements HTSManagerCallbacks
|
||||
private Float temp;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private HTSManager manager;
|
||||
private HTManager manager;
|
||||
|
||||
private final LocalBinder minder = new HTSBinder();
|
||||
|
||||
@@ -90,8 +90,8 @@ public class HTSService extends BleProfileService implements HTSManagerCallbacks
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LoggableBleManager<HTSManagerCallbacks> initializeManager() {
|
||||
return manager = new HTSManager(this);
|
||||
protected LoggableBleManager<HTManagerCallbacks> initializeManager() {
|
||||
return manager = new HTManager(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,7 +194,7 @@ public class HTSService extends BleProfileService implements HTSManagerCallbacks
|
||||
private Notification createNotification(final int messageResId, final int defaults) {
|
||||
final Intent parentIntent = new Intent(this, FeaturesActivity.class);
|
||||
parentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
final Intent targetIntent = new Intent(this, HTSActivity.class);
|
||||
final Intent targetIntent = new Intent(this, HTActivity.class);
|
||||
|
||||
final Intent disconnect = new Intent(ACTION_DISCONNECT);
|
||||
final PendingIntent disconnectAction = PendingIntent.getBroadcast(this, DISCONNECT_REQ, disconnect, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
@@ -20,7 +20,7 @@
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package no.nordicsemi.android.nrftoolbox.hts.settings;
|
||||
package no.nordicsemi.android.nrftoolbox.ht.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
@@ -20,10 +20,9 @@
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package no.nordicsemi.android.nrftoolbox.hts.settings;
|
||||
package no.nordicsemi.android.nrftoolbox.ht.settings;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceFragment;
|
||||
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import no.nordicsemi.android.nrftoolbox.R;
|
||||
@@ -143,7 +143,7 @@ public abstract class BleProfileExpandableListActivity extends ExpandableListAct
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(final Bundle outState) {
|
||||
protected void onSaveInstanceState(@NonNull final Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(SIS_CONNECTION_STATUS, deviceConnected);
|
||||
outState.putString(SIS_DEVICE_NAME, deviceName);
|
||||
|
||||
@@ -37,11 +37,11 @@ import java.util.List;
|
||||
|
||||
import no.nordicsemi.android.nrftoolbox.R;
|
||||
|
||||
public class DeviceAdapter extends RecyclerView.Adapter<DeviceAdapter.ViewHolder> {
|
||||
class DeviceAdapter extends RecyclerView.Adapter<DeviceAdapter.ViewHolder> {
|
||||
private final ProximityService.ProximityBinder service;
|
||||
private final List<BluetoothDevice> devices;
|
||||
|
||||
DeviceAdapter(final ProximityService.ProximityBinder binder) {
|
||||
DeviceAdapter(@NonNull final ProximityService.ProximityBinder binder) {
|
||||
service = binder;
|
||||
devices = service.getManagedDevices();
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class DeviceAdapter extends RecyclerView.Adapter<DeviceAdapter.ViewHolder
|
||||
return devices.size();
|
||||
}
|
||||
|
||||
public void onDeviceAdded(final BluetoothDevice device) {
|
||||
void onDeviceAdded(final BluetoothDevice device) {
|
||||
final int position = devices.indexOf(device);
|
||||
if (position == -1) {
|
||||
notifyItemInserted(devices.size() - 1);
|
||||
@@ -74,17 +74,17 @@ public class DeviceAdapter extends RecyclerView.Adapter<DeviceAdapter.ViewHolder
|
||||
}
|
||||
}
|
||||
|
||||
public void onDeviceRemoved(final BluetoothDevice device) {
|
||||
void onDeviceRemoved(final BluetoothDevice device) {
|
||||
notifyDataSetChanged(); // we don't have position of the removed device here
|
||||
}
|
||||
|
||||
public void onDeviceStateChanged(final BluetoothDevice device) {
|
||||
void onDeviceStateChanged(final BluetoothDevice device) {
|
||||
final int position = devices.indexOf(device);
|
||||
if (position >= 0)
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
|
||||
public void onBatteryValueReceived(final BluetoothDevice device) {
|
||||
void onBatteryValueReceived(final BluetoothDevice device) {
|
||||
final int position = devices.indexOf(device);
|
||||
if (position >= 0)
|
||||
notifyItemChanged(position);
|
||||
@@ -123,7 +123,7 @@ public class DeviceAdapter extends RecyclerView.Adapter<DeviceAdapter.ViewHolder
|
||||
});
|
||||
}
|
||||
|
||||
private void bind(final BluetoothDevice device) {
|
||||
private void bind(@NonNull final BluetoothDevice device) {
|
||||
final boolean ready = service.isReady(device);
|
||||
|
||||
String name = device.getName();
|
||||
|
||||
@@ -29,13 +29,13 @@ import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import no.nordicsemi.android.nrftoolbox.R;
|
||||
|
||||
public class LinkLossFragment extends DialogFragment {
|
||||
public class LinkLossDialogFragment extends DialogFragment {
|
||||
private static final String ARG_NAME = "name";
|
||||
|
||||
private String name;
|
||||
|
||||
public static LinkLossFragment getInstance(String name) {
|
||||
final LinkLossFragment fragment = new LinkLossFragment();
|
||||
public static LinkLossDialogFragment getInstance(@NonNull final String name) {
|
||||
final LinkLossDialogFragment fragment = new LinkLossDialogFragment();
|
||||
|
||||
final Bundle args = new Bundle();
|
||||
args.putString(ARG_NAME, name);
|
||||
@@ -48,7 +48,7 @@ public class LinkLossFragment extends DialogFragment {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
name = getArguments().getString(ARG_NAME);
|
||||
name = requireArguments().getString(ARG_NAME);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -159,7 +159,7 @@ public class ProximityActivity extends BleMulticonnectProfileServiceReadyActivit
|
||||
|
||||
private void showLinkLossDialog(final String name) {
|
||||
try {
|
||||
final LinkLossFragment dialog = LinkLossFragment.getInstance(name);
|
||||
final LinkLossDialogFragment dialog = LinkLossDialogFragment.getInstance(name);
|
||||
dialog.show(getSupportFragmentManager(), "scan_fragment");
|
||||
} catch (final Exception e) {
|
||||
// the activity must have been destroyed
|
||||
|
||||
@@ -53,14 +53,14 @@ public class RSCManager extends BatteryManager<RSCManagerCallbacks> {
|
||||
@NonNull
|
||||
@Override
|
||||
protected BatteryManagerGattCallback getGattCallback() {
|
||||
return gattCallback;
|
||||
return new RSCManagerGattCallback();
|
||||
}
|
||||
|
||||
/**
|
||||
* BluetoothGatt callbacks for connection/disconnection, service discovery,
|
||||
* receiving indication, etc.
|
||||
*/
|
||||
private final BatteryManagerGattCallback gattCallback = new BatteryManagerGattCallback() {
|
||||
private class RSCManagerGattCallback extends BatteryManagerGattCallback {
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
@@ -99,5 +99,5 @@ public class RSCManager extends BatteryManager<RSCManagerCallbacks> {
|
||||
super.onDeviceDisconnected();
|
||||
rscMeasurementCharacteristic = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".cgms.CGMSActivity">
|
||||
tools:context=".cgm.CGMSActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_actionbar"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".hrs.HRSActivity">
|
||||
tools:context=".hr.HRActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_actionbar"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".hts.HTSActivity">
|
||||
tools:context=".ht.HTActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_actionbar"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".hrs.HRSActivity">
|
||||
tools:context=".hr.HRActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_actionbar"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".hrs.HRSActivity">
|
||||
tools:context=".hr.HRActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_actionbar"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".hts.HTSActivity">
|
||||
tools:context=".ht.HTActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbar_actionbar"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<?xml version="1.0" encoding="utf-8"?><!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ Copyright (c) 2015, Nordic Semiconductor
|
||||
~ All rights reserved.
|
||||
~
|
||||
@@ -21,12 +20,13 @@
|
||||
~ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_actionbar"
|
||||
style="@style/HeaderBar"
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/toolbar_actionbar"
|
||||
style="@style/HeaderBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:theme="@style/ActionBarThemeOverlay"
|
||||
app:popupTheme="@style/ActionBarPopupThemeOverlay"
|
||||
app:titleTextAppearance="@style/ActionBar.TitleText"/>
|
||||
app:titleTextAppearance="@style/ActionBar.TitleText" />
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
<?xml version="1.0" encoding="utf-8"?><!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ Copyright (c) 2015, Nordic Semiconductor
|
||||
~ All rights reserved.
|
||||
~
|
||||
@@ -21,11 +20,11 @@
|
||||
~ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar_actionbar"
|
||||
style="@style/HeaderBar"
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/toolbar_actionbar"
|
||||
style="@style/HeaderBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:theme="@style/ActionBarThemeOverlay"
|
||||
@@ -36,5 +35,5 @@
|
||||
android:id="@+id/toolbar_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:minWidth="160dp"/>
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
android:minWidth="160dp" />
|
||||
</com.google.android.material.appbar.MaterialToolbar>
|
||||
@@ -98,7 +98,7 @@
|
||||
</style>
|
||||
|
||||
<style name="Widget.Connect" parent="@style/Widget.MaterialComponents.Button">
|
||||
<item name="theme">@style/ConnectTheme</item>
|
||||
<item name="android:theme">@style/ConnectTheme</item>
|
||||
<item name="android:minWidth">200dp</item>
|
||||
<item name="android:minHeight">52dp</item>
|
||||
</style>
|
||||
|
||||
@@ -3,9 +3,9 @@ include ':app', ':wear', ':common'
|
||||
// Uncomment these lines if you want to import the BLE Library and BLE Common Library as a project,
|
||||
// not from jcenter:
|
||||
|
||||
// include ':ble', ':ble-common'
|
||||
// project(':ble').projectDir = file('../Android-BLE-Library/ble')
|
||||
// project(':ble-common').projectDir = file('../Android-BLE-Common-Library/ble-common')
|
||||
include ':ble', ':ble-common'
|
||||
project(':ble').projectDir = file('../Android-BLE-Library/ble')
|
||||
project(':ble-common').projectDir = file('../Android-BLE-Common-Library/ble-common')
|
||||
|
||||
// Uncomment these lines if you want to import the DFULibrary as a project, not from jcenter:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user