Minor refactoring: S removed from class and packages names

This commit is contained in:
Aleksander Nowakowski
2020-01-31 15:04:43 +01:00
parent 807f90ccc7
commit a5440a40c0
34 changed files with 155 additions and 155 deletions

View File

@@ -57,11 +57,11 @@ dependencies {
// Import the BLE Common Library. // Import the BLE Common Library.
// The BLE Common Library depends on BLE Library. It is enough to include the first one. // 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, // 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 // clone both projects from GitHub and replace the line above with the following
// (and also the according lines in the settings.gradle): // (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') { implementation('org.simpleframework:simple-xml:2.7.1') {
exclude group: 'stax', module: 'stax-api' exclude group: 'stax', module: 'stax-api'

View File

@@ -119,7 +119,7 @@
android:name="no.nordicsemi.android.nrftoolbox.dfu.NotificationActivity" android:name="no.nordicsemi.android.nrftoolbox.dfu.NotificationActivity"
android:label="@string/dfu_feature_title" /> android:label="@string/dfu_feature_title" />
<activity <activity
android:name="no.nordicsemi.android.nrftoolbox.hrs.HRSActivity" android:name="no.nordicsemi.android.nrftoolbox.hr.HRActivity"
android:icon="@drawable/ic_hrs_feature" android:icon="@drawable/ic_hrs_feature"
android:label="@string/hrs_feature_title" > android:label="@string/hrs_feature_title" >
<intent-filter> <intent-filter>
@@ -129,7 +129,7 @@
</intent-filter> </intent-filter>
</activity> </activity>
<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:icon="@drawable/ic_hts_feature"
android:label="@string/hts_feature_title" > android:label="@string/hts_feature_title" >
<intent-filter> <intent-filter>
@@ -139,7 +139,7 @@
</intent-filter> </intent-filter>
</activity> </activity>
<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" /> android:label="@string/hts_settings_title" />
<activity <activity
android:name="no.nordicsemi.android.nrftoolbox.bpm.BPMActivity" android:name="no.nordicsemi.android.nrftoolbox.bpm.BPMActivity"
@@ -212,7 +212,7 @@
<category android:name="no.nordicsemi.android.nrftoolbox.LAUNCHER" /> <category android:name="no.nordicsemi.android.nrftoolbox.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </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:icon="@drawable/ic_cgms_feature"
android:label="@string/cgms_feature_title" android:label="@string/cgms_feature_title"
android:launchMode="singleTask"> android:launchMode="singleTask">
@@ -250,7 +250,7 @@
</activity> </activity>
<service <service
android:name="no.nordicsemi.android.nrftoolbox.cgms.CGMService" android:name="no.nordicsemi.android.nrftoolbox.cgm.CGMService"
android:label="@string/cgms_feature_title" /> android:label="@string/cgms_feature_title" />
<service <service
android:name="no.nordicsemi.android.nrftoolbox.rsc.RSCService" android:name="no.nordicsemi.android.nrftoolbox.rsc.RSCService"
@@ -259,7 +259,7 @@
android:name="no.nordicsemi.android.nrftoolbox.csc.CSCService" android:name="no.nordicsemi.android.nrftoolbox.csc.CSCService"
android:label="@string/csc_feature_title" /> android:label="@string/csc_feature_title" />
<service <service
android:name="no.nordicsemi.android.nrftoolbox.hts.HTSService" android:name="no.nordicsemi.android.nrftoolbox.ht.HTService"
android:label="@string/hts_feature_title" /> android:label="@string/hts_feature_title" />
<service <service
android:name="no.nordicsemi.android.nrftoolbox.uart.UARTService" android:name="no.nordicsemi.android.nrftoolbox.uart.UARTService"

View File

@@ -52,7 +52,7 @@ import android.widget.Toast;
import java.util.List; import java.util.List;
import no.nordicsemi.android.nrftoolbox.adapter.AppAdapter; 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 { public class FeaturesActivity extends AppCompatActivity {
private static final String NRF_CONNECT_CATEGORY = "no.nordicsemi.android.nrftoolbox.LAUNCHER"; 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); final String app = intent.getStringExtra(EXTRA_APP);
switch (app) { switch (app) {
case "HRM": 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.putExtra(EXTRA_ADDRESS, intent.getByteArrayExtra(EXTRA_ADDRESS));
newIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); newIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(newIntent); startActivity(newIntent);

View File

@@ -20,7 +20,7 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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.annotation.SuppressLint;
import android.bluetooth.BluetoothDevice; 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.CGMSpecificOpsControlPointParser;
import no.nordicsemi.android.nrftoolbox.parser.RecordAccessControlPointParser; import no.nordicsemi.android.nrftoolbox.parser.RecordAccessControlPointParser;
class CGMSManager extends BatteryManager<CGMSManagerCallbacks> { class CGMManager extends BatteryManager<CGMManagerCallbacks> {
/** Cycling Speed and Cadence service UUID. */ /** Cycling Speed and Cadence service UUID. */
static final UUID CGMS_UUID = UUID.fromString("0000181F-0000-1000-8000-00805f9b34fb"); 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"); 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 cgmSpecificOpsControlPointCharacteristic;
private BluetoothGattCharacteristic recordAccessControlPointCharacteristic; 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. */ /** A flag set to true if the remote device supports E2E CRC. */
private boolean secured; private boolean secured;
@@ -80,7 +80,7 @@ class CGMSManager extends BatteryManager<CGMSManagerCallbacks> {
*/ */
private long sessionStartTime; private long sessionStartTime;
CGMSManager(final Context context) { CGMManager(final Context context) {
super(context); super(context);
} }
@@ -108,8 +108,8 @@ class CGMSManager extends BatteryManager<CGMSManagerCallbacks> {
@Override @Override
public void onContinuousGlucoseMonitorFeaturesReceived(@NonNull final BluetoothDevice device, @NonNull final CGMFeatures features, public void onContinuousGlucoseMonitorFeaturesReceived(@NonNull final BluetoothDevice device, @NonNull final CGMFeatures features,
final int type, final int sampleLocation, final boolean secured) { final int type, final int sampleLocation, final boolean secured) {
CGMSManager.this.secured = features.e2eCrcSupported; CGMManager.this.secured = features.e2eCrcSupported;
log(LogContract.Log.Level.APPLICATION, "E2E CRC feature " + (CGMSManager.this.secured ? "supported" : "not supported")); 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")) .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 // 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 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); records.put(record.sequenceNumber, record);
callbacks.onCGMValueReceived(device, 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 * 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; return records;
} }

View File

@@ -20,16 +20,16 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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.bluetooth.BluetoothDevice;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import no.nordicsemi.android.nrftoolbox.battery.BatteryManagerCallbacks; 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); void onOperationStarted(final @NonNull BluetoothDevice device);

View File

@@ -1,9 +1,9 @@
package no.nordicsemi.android.nrftoolbox.cgms; package no.nordicsemi.android.nrftoolbox.cgm;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
class CGMSRecord implements Parcelable{ class CGMRecord implements Parcelable{
/** Record sequence number. */ /** Record sequence number. */
int sequenceNumber; int sequenceNumber;
/** The base time of the measurement (start time + sequenceNumber of minutes). */ /** 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. */ /** The glucose concentration in mg/dL. */
float glucoseConcentration; 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.sequenceNumber = sequenceNumber;
this.glucoseConcentration = glucoseConcentration; this.glucoseConcentration = glucoseConcentration;
this.timestamp = timestamp; this.timestamp = timestamp;
} }
private CGMSRecord(final Parcel in) { private CGMRecord(final Parcel in) {
this.sequenceNumber = in.readInt(); this.sequenceNumber = in.readInt();
this.glucoseConcentration = in.readFloat(); this.glucoseConcentration = in.readFloat();
this.timestamp = in.readLong(); this.timestamp = in.readLong();
} }
public static final Creator<CGMSRecord> CREATOR = new Creator<CGMSRecord>() { public static final Creator<CGMRecord> CREATOR = new Creator<CGMRecord>() {
@Override @Override
public CGMSRecord createFromParcel(final Parcel in) { public CGMRecord createFromParcel(final Parcel in) {
return new CGMSRecord(in); return new CGMRecord(in);
} }
@Override @Override
public CGMSRecord[] newArray(final int size) { public CGMRecord[] newArray(final int size) {
return new CGMSRecord[size]; return new CGMRecord[size];
} }
}; };

View File

@@ -1,4 +1,4 @@
package no.nordicsemi.android.nrftoolbox.cgms; package no.nordicsemi.android.nrftoolbox.cgm;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@@ -17,13 +17,13 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import no.nordicsemi.android.nrftoolbox.R; 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 final static SimpleDateFormat timeFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm", Locale.US);
private List<CGMSRecord> records; private List<CGMRecord> records;
private LayoutInflater inflater; private LayoutInflater inflater;
CGMSRecordsAdapter(@NonNull final Context context) { CGMRecordsAdapter(@NonNull final Context context) {
records = new ArrayList<>(); records = new ArrayList<>();
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
} }
@@ -58,15 +58,15 @@ class CGMSRecordsAdapter extends BaseAdapter {
viewHolder = (ViewHolder) view.getTag(); viewHolder = (ViewHolder) view.getTag();
} }
final CGMSRecord cgmsRecord = records.get(position); final CGMRecord CGMRecord = records.get(position);
viewHolder.concentration.setText(String.valueOf(cgmsRecord.glucoseConcentration)); viewHolder.concentration.setText(String.valueOf(CGMRecord.glucoseConcentration));
viewHolder.details.setText(viewHolder.details.getResources().getString(R.string.cgms_details, cgmsRecord.sequenceNumber)); viewHolder.details.setText(viewHolder.details.getResources().getString(R.string.cgms_details, CGMRecord.sequenceNumber));
viewHolder.time.setText(timeFormat.format(new Date(cgmsRecord.timestamp))); viewHolder.time.setText(timeFormat.format(new Date(CGMRecord.timestamp)));
return view; return view;
} }
void addItem(final CGMSRecord record) { void addItem(final CGMRecord record) {
records.add(record); records.add(record);
} }

View File

@@ -20,7 +20,7 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
@@ -51,7 +51,7 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
private View controlPanelAbort; private View controlPanelAbort;
private ListView recordsListView; private ListView recordsListView;
private TextView batteryLevelView; private TextView batteryLevelView;
private CGMSRecordsAdapter cgmsRecordsAdapter; private CGMRecordsAdapter CGMRecordsAdapter;
private CGMService.CGMSBinder binder; private CGMService.CGMSBinder binder;
@@ -102,12 +102,12 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
}); });
} }
private void loadAdapter(SparseArray<CGMSRecord> records) { private void loadAdapter(SparseArray<CGMRecord> records) {
cgmsRecordsAdapter.clear(); CGMRecordsAdapter.clear();
for (int i = 0; i < records.size(); i++) { for (int i = 0; i < records.size(); i++) {
cgmsRecordsAdapter.addItem(records.valueAt(i)); CGMRecordsAdapter.addItem(records.valueAt(i));
} }
cgmsRecordsAdapter.notifyDataSetChanged(); CGMRecordsAdapter.notifyDataSetChanged();
} }
@Override @Override
@@ -119,11 +119,11 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
@Override @Override
protected void onServiceBound(final CGMService.CGMSBinder binder) { protected void onServiceBound(final CGMService.CGMSBinder binder) {
this.binder = binder; this.binder = binder;
final SparseArray<CGMSRecord> cgmsRecords = binder.getRecords(); final SparseArray<CGMRecord> cgmsRecords = binder.getRecords();
if (cgmsRecords != null && cgmsRecords.size() > 0) { if (cgmsRecords != null && cgmsRecords.size() > 0) {
if (cgmsRecordsAdapter == null) { if (CGMRecordsAdapter == null) {
cgmsRecordsAdapter = new CGMSRecordsAdapter(CGMSActivity.this); CGMRecordsAdapter = new CGMRecordsAdapter(CGMSActivity.this);
recordsListView.setAdapter(cgmsRecordsAdapter); recordsListView.setAdapter(CGMRecordsAdapter);
} }
loadAdapter(cgmsRecords); loadAdapter(cgmsRecords);
} }
@@ -156,7 +156,7 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
@Override @Override
protected UUID getFilterUUID() { protected UUID getFilterUUID() {
return CGMSManager.CGMS_UUID; return CGMManager.CGMS_UUID;
} }
@Override @Override
@@ -219,9 +219,9 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
} }
private void clearRecords() { private void clearRecords() {
if (cgmsRecordsAdapter != null) { if (CGMRecordsAdapter != null) {
cgmsRecordsAdapter.clear(); CGMRecordsAdapter.clear();
cgmsRecordsAdapter.notifyDataSetChanged(); CGMRecordsAdapter.notifyDataSetChanged();
} }
} }
@@ -233,13 +233,13 @@ public class CGMSActivity extends BleProfileServiceReadyActivity<CGMService.CGMS
switch (action) { switch (action) {
case CGMService.BROADCAST_NEW_CGMS_VALUE: { case CGMService.BROADCAST_NEW_CGMS_VALUE: {
CGMSRecord cgmsRecord = intent.getExtras().getParcelable(CGMService.EXTRA_CGMS_RECORD); CGMRecord CGMRecord = intent.getExtras().getParcelable(CGMService.EXTRA_CGMS_RECORD);
if (cgmsRecordsAdapter == null) { if (CGMRecordsAdapter == null) {
cgmsRecordsAdapter = new CGMSRecordsAdapter(CGMSActivity.this); CGMRecordsAdapter = new CGMRecordsAdapter(CGMSActivity.this);
recordsListView.setAdapter(cgmsRecordsAdapter); recordsListView.setAdapter(CGMRecordsAdapter);
} }
cgmsRecordsAdapter.addItem(cgmsRecord); CGMRecordsAdapter.addItem(CGMRecord);
cgmsRecordsAdapter.notifyDataSetChanged(); CGMRecordsAdapter.notifyDataSetChanged();
break; break;
} }
case CGMService.BROADCAST_DATA_SET_CLEAR: case CGMService.BROADCAST_DATA_SET_CLEAR:

View File

@@ -1,4 +1,4 @@
package no.nordicsemi.android.nrftoolbox.cgms; package no.nordicsemi.android.nrftoolbox.cgm;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; 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.BleProfileService;
import no.nordicsemi.android.nrftoolbox.profile.LoggableBleManager; 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"; 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"; 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 OPEN_ACTIVITY_REQ = 0;
private final static int DISCONNECT_REQ = 1; private final static int DISCONNECT_REQ = 1;
private CGMSManager manager; private CGMManager manager;
private final LocalBinder binder = new CGMSBinder(); private final LocalBinder binder = new CGMSBinder();
/** /**
@@ -55,7 +55,7 @@ public class CGMService extends BleProfileService implements CGMSManagerCallback
* *
* @return the records list * @return the records list
*/ */
SparseArray<CGMSRecord> getRecords() { SparseArray<CGMRecord> getRecords() {
return manager.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. * 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 * 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() { void getFirstRecord() {
if (manager != null) if (manager != null)
@@ -132,8 +132,8 @@ public class CGMService extends BleProfileService implements CGMSManagerCallback
} }
@Override @Override
protected LoggableBleManager<CGMSManagerCallbacks> initializeManager() { protected LoggableBleManager<CGMManagerCallbacks> initializeManager() {
return manager = new CGMSManager(this); return manager = new CGMManager(this);
} }
@@ -243,7 +243,7 @@ public class CGMService extends BleProfileService implements CGMSManagerCallback
}; };
@Override @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); final Intent broadcast = new Intent(BROADCAST_NEW_CGMS_VALUE);
broadcast.putExtra(EXTRA_DEVICE, getBluetoothDevice()); broadcast.putExtra(EXTRA_DEVICE, getBluetoothDevice());
broadcast.putExtra(EXTRA_CGMS_RECORD, record); broadcast.putExtra(EXTRA_CGMS_RECORD, record);

View File

@@ -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 * 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. * 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.BluetoothAdapter;
import android.bluetooth.BluetoothDevice; 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. * 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. // 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") @SuppressWarnings("unused")
private final String TAG = "HRSActivity"; private final String TAG = "HRSActivity";
@@ -151,7 +151,7 @@ public class HRSActivity extends BleProfileActivity implements HRSManagerCallbac
@Override @Override
protected UUID getFilterUUID() { protected UUID getFilterUUID() {
return HRSManager.HR_SERVICE_UUID; return HRManager.HR_SERVICE_UUID;
} }
private void updateGraph(final int hrmValue) { private void updateGraph(final int hrmValue) {
@@ -181,8 +181,8 @@ public class HRSActivity extends BleProfileActivity implements HRSManagerCallbac
} }
@Override @Override
protected LoggableBleManager<HRSManagerCallbacks> initializeManager() { protected LoggableBleManager<HRManagerCallbacks> initializeManager() {
final HRSManager manager = HRSManager.getInstance(getApplicationContext()); final HRManager manager = HRManager.getInstance(getApplicationContext());
manager.setManagerCallbacks(this); manager.setManagerCallbacks(this);
return manager; return manager;
} }

View File

@@ -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 * 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. * 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.BluetoothDevice;
import android.bluetooth.BluetoothGatt; 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 * All operations required to connect to device with BLE Heart Rate Service and reading
* heart rate values are performed here. * 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"); 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 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 static final UUID HEART_RATE_MEASUREMENT_CHARACTERISTIC_UUID = UUID.fromString("00002A37-0000-1000-8000-00805f9b34fb");
private BluetoothGattCharacteristic heartRateCharacteristic, bodySensorLocationCharacteristic; private BluetoothGattCharacteristic heartRateCharacteristic, bodySensorLocationCharacteristic;
private static HRSManager managerInstance = null; private static HRManager managerInstance = null;
/** /**
* Singleton implementation of HRSManager class. * Singleton implementation of HRSManager class.
*/ */
public static synchronized HRSManager getInstance(final Context context) { public static synchronized HRManager getInstance(final Context context) {
if (managerInstance == null) { if (managerInstance == null) {
managerInstance = new HRSManager(context); managerInstance = new HRManager(context);
} }
return managerInstance; return managerInstance;
} }
private HRSManager(final Context context) { private HRManager(final Context context) {
super(context); super(context);
} }

View File

@@ -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 * 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. * 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.BodySensorLocationCallback;
import no.nordicsemi.android.ble.common.profile.hr.HeartRateMeasurementCallback; import no.nordicsemi.android.ble.common.profile.hr.HeartRateMeasurementCallback;
import no.nordicsemi.android.nrftoolbox.battery.BatteryManagerCallbacks; import no.nordicsemi.android.nrftoolbox.battery.BatteryManagerCallbacks;
interface HRSManagerCallbacks extends BatteryManagerCallbacks, BodySensorLocationCallback, HeartRateMeasurementCallback { interface HRManagerCallbacks extends BatteryManagerCallbacks, BodySensorLocationCallback, HeartRateMeasurementCallback {
} }

View File

@@ -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 * 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. * 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.content.Context;
import android.graphics.Color; import android.graphics.Color;

View File

@@ -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 * 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. * 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.BluetoothDevice;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
@@ -38,17 +38,17 @@ import android.widget.TextView;
import java.util.UUID; import java.util.UUID;
import no.nordicsemi.android.nrftoolbox.R; import no.nordicsemi.android.nrftoolbox.R;
import no.nordicsemi.android.nrftoolbox.hts.settings.SettingsActivity; import no.nordicsemi.android.nrftoolbox.ht.settings.SettingsActivity;
import no.nordicsemi.android.nrftoolbox.hts.settings.SettingsFragment; import no.nordicsemi.android.nrftoolbox.ht.settings.SettingsFragment;
import no.nordicsemi.android.nrftoolbox.profile.BleProfileService; import no.nordicsemi.android.nrftoolbox.profile.BleProfileService;
import no.nordicsemi.android.nrftoolbox.profile.BleProfileServiceReadyActivity; import no.nordicsemi.android.nrftoolbox.profile.BleProfileServiceReadyActivity;
/** /**
* HTSActivity is the main Health Thermometer activity. It implements {@link HTSManagerCallbacks} * HTSActivity is the main Health Thermometer activity. It implements {@link HTManagerCallbacks}
* to receive callbacks from {@link HTSManager} class. The activity supports portrait and landscape * to receive callbacks from {@link HTManager} class. The activity supports portrait and landscape
* orientations. * orientations.
*/ */
public class HTSActivity extends BleProfileServiceReadyActivity<HTSService.HTSBinder> { public class HTActivity extends BleProfileServiceReadyActivity<HTService.HTSBinder> {
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final String TAG = "HTSActivity"; private final String TAG = "HTSActivity";
@@ -111,7 +111,7 @@ public class HTSActivity extends BleProfileServiceReadyActivity<HTSService.HTSBi
} }
@Override @Override
protected void onServiceBound(final HTSService.HTSBinder binder) { protected void onServiceBound(final HTService.HTSBinder binder) {
onTemperatureMeasurementReceived(binder.getTemperature()); onTemperatureMeasurementReceived(binder.getTemperature());
} }
@@ -154,12 +154,12 @@ public class HTSActivity extends BleProfileServiceReadyActivity<HTSService.HTSBi
@Override @Override
protected UUID getFilterUUID() { protected UUID getFilterUUID() {
return HTSManager.HT_SERVICE_UUID; return HTManager.HT_SERVICE_UUID;
} }
@Override @Override
protected Class<? extends BleProfileService> getServiceClass() { protected Class<? extends BleProfileService> getServiceClass() {
return HTSService.class; return HTService.class;
} }
@Override @Override
@@ -204,12 +204,12 @@ public class HTSActivity extends BleProfileServiceReadyActivity<HTSService.HTSBi
public void onReceive(final Context context, final Intent intent) { public void onReceive(final Context context, final Intent intent) {
final String action = intent.getAction(); final String action = intent.getAction();
if (HTSService.BROADCAST_HTS_MEASUREMENT.equals(action)) { if (HTService.BROADCAST_HTS_MEASUREMENT.equals(action)) {
final float value = intent.getFloatExtra(HTSService.EXTRA_TEMPERATURE, 0.0f); final float value = intent.getFloatExtra(HTService.EXTRA_TEMPERATURE, 0.0f);
// Update GUI // Update GUI
onTemperatureMeasurementReceived(value); onTemperatureMeasurementReceived(value);
} else if (HTSService.BROADCAST_BATTERY_LEVEL.equals(action)) { } else if (HTService.BROADCAST_BATTERY_LEVEL.equals(action)) {
final int batteryLevel = intent.getIntExtra(HTSService.EXTRA_BATTERY_LEVEL, 0); final int batteryLevel = intent.getIntExtra(HTService.EXTRA_BATTERY_LEVEL, 0);
// Update GUI // Update GUI
onBatteryLevelChanged(batteryLevel); onBatteryLevelChanged(batteryLevel);
} }
@@ -218,8 +218,8 @@ public class HTSActivity extends BleProfileServiceReadyActivity<HTSService.HTSBi
private static IntentFilter makeIntentFilter() { private static IntentFilter makeIntentFilter() {
final IntentFilter intentFilter = new IntentFilter(); final IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(HTSService.BROADCAST_HTS_MEASUREMENT); intentFilter.addAction(HTService.BROADCAST_HTS_MEASUREMENT);
intentFilter.addAction(HTSService.BROADCAST_BATTERY_LEVEL); intentFilter.addAction(HTService.BROADCAST_BATTERY_LEVEL);
return intentFilter; return intentFilter;
} }
} }

View File

@@ -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 * 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. * 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.BluetoothDevice;
import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGatt;
@@ -41,12 +41,13 @@ import no.nordicsemi.android.nrftoolbox.battery.BatteryManager;
import no.nordicsemi.android.nrftoolbox.parser.TemperatureMeasurementParser; import no.nordicsemi.android.nrftoolbox.parser.TemperatureMeasurementParser;
/** /**
* HTSManager class performs BluetoothGatt operations for connection, service discovery, enabling * {@link HTManager} class performs {@link BluetoothGatt} operations for connection, service discovery,
* indication and reading characteristics. All operations required to connect to device with BLE HT * enabling indication and reading characteristics. All operations required to connect to device
* Service and reading health thermometer values are performed here. * with BLE HT Service and reading health thermometer values are performed here.
* HTSActivity implements HTSManagerCallbacks in order to receive callbacks of BluetoothGatt operations. * {@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 */ /** Health Thermometer service UUID */
final static UUID HT_SERVICE_UUID = UUID.fromString("00001809-0000-1000-8000-00805f9b34fb"); final static UUID HT_SERVICE_UUID = UUID.fromString("00001809-0000-1000-8000-00805f9b34fb");
/** Health Thermometer Measurement characteristic UUID */ /** Health Thermometer Measurement characteristic UUID */
@@ -54,7 +55,7 @@ public class HTSManager extends BatteryManager<HTSManagerCallbacks> {
private BluetoothGattCharacteristic htCharacteristic; private BluetoothGattCharacteristic htCharacteristic;
HTSManager(final Context context) { HTManager(final Context context) {
super(context); super(context);
} }
@@ -82,7 +83,8 @@ public class HTSManager extends BatteryManager<HTSManagerCallbacks> {
@Override @Override
public void onTemperatureMeasurementReceived(@NonNull final BluetoothDevice device, 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 final Calendar calendar,
@Nullable @TemperatureType final Integer type) { @Nullable @TemperatureType final Integer type) {
callbacks.onTemperatureMeasurementReceived(device, temperature, unit, calendar, type); callbacks.onTemperatureMeasurementReceived(device, temperature, unit, calendar, type);

View File

@@ -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 * 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. * 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.ble.common.profile.ht.TemperatureMeasurementCallback;
import no.nordicsemi.android.nrftoolbox.battery.BatteryManagerCallbacks; import no.nordicsemi.android.nrftoolbox.battery.BatteryManagerCallbacks;
/** /**
* Interface {@link HTSManagerCallbacks} must be implemented by {@link HTSActivity} in order * Interface {@link HTManagerCallbacks} must be implemented by {@link HTActivity} in order
* to receive callbacks from {@link HTSManager}. * to receive callbacks from {@link HTManager}.
*/ */
interface HTSManagerCallbacks extends BatteryManagerCallbacks, TemperatureMeasurementCallback { interface HTManagerCallbacks extends BatteryManagerCallbacks, TemperatureMeasurementCallback {
} }

View File

@@ -20,7 +20,7 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
@@ -50,7 +50,7 @@ import no.nordicsemi.android.nrftoolbox.profile.BleProfileService;
import no.nordicsemi.android.nrftoolbox.profile.LoggableBleManager; import no.nordicsemi.android.nrftoolbox.profile.LoggableBleManager;
@SuppressWarnings("FieldCanBeLocal") @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 BROADCAST_HTS_MEASUREMENT = "no.nordicsemi.android.nrftoolbox.hts.BROADCAST_HTS_MEASUREMENT";
public static final String EXTRA_TEMPERATURE = "no.nordicsemi.android.nrftoolbox.hts.EXTRA_TEMPERATURE"; 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; private Float temp;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private HTSManager manager; private HTManager manager;
private final LocalBinder minder = new HTSBinder(); private final LocalBinder minder = new HTSBinder();
@@ -90,8 +90,8 @@ public class HTSService extends BleProfileService implements HTSManagerCallbacks
} }
@Override @Override
protected LoggableBleManager<HTSManagerCallbacks> initializeManager() { protected LoggableBleManager<HTManagerCallbacks> initializeManager() {
return manager = new HTSManager(this); return manager = new HTManager(this);
} }
@Override @Override
@@ -194,7 +194,7 @@ public class HTSService extends BleProfileService implements HTSManagerCallbacks
private Notification createNotification(final int messageResId, final int defaults) { private Notification createNotification(final int messageResId, final int defaults) {
final Intent parentIntent = new Intent(this, FeaturesActivity.class); final Intent parentIntent = new Intent(this, FeaturesActivity.class);
parentIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 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 Intent disconnect = new Intent(ACTION_DISCONNECT);
final PendingIntent disconnectAction = PendingIntent.getBroadcast(this, DISCONNECT_REQ, disconnect, PendingIntent.FLAG_UPDATE_CURRENT); final PendingIntent disconnectAction = PendingIntent.getBroadcast(this, DISCONNECT_REQ, disconnect, PendingIntent.FLAG_UPDATE_CURRENT);

View File

@@ -20,7 +20,7 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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.os.Bundle;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;

View File

@@ -20,10 +20,9 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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.os.Bundle;
import android.preference.PreferenceFragment;
import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
import no.nordicsemi.android.nrftoolbox.R; import no.nordicsemi.android.nrftoolbox.R;

View File

@@ -143,7 +143,7 @@ public abstract class BleProfileExpandableListActivity extends ExpandableListAct
} }
@Override @Override
protected void onSaveInstanceState(final Bundle outState) { protected void onSaveInstanceState(@NonNull final Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
outState.putBoolean(SIS_CONNECTION_STATUS, deviceConnected); outState.putBoolean(SIS_CONNECTION_STATUS, deviceConnected);
outState.putString(SIS_DEVICE_NAME, deviceName); outState.putString(SIS_DEVICE_NAME, deviceName);

View File

@@ -37,11 +37,11 @@ import java.util.List;
import no.nordicsemi.android.nrftoolbox.R; 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 ProximityService.ProximityBinder service;
private final List<BluetoothDevice> devices; private final List<BluetoothDevice> devices;
DeviceAdapter(final ProximityService.ProximityBinder binder) { DeviceAdapter(@NonNull final ProximityService.ProximityBinder binder) {
service = binder; service = binder;
devices = service.getManagedDevices(); devices = service.getManagedDevices();
} }
@@ -63,7 +63,7 @@ public class DeviceAdapter extends RecyclerView.Adapter<DeviceAdapter.ViewHolder
return devices.size(); return devices.size();
} }
public void onDeviceAdded(final BluetoothDevice device) { void onDeviceAdded(final BluetoothDevice device) {
final int position = devices.indexOf(device); final int position = devices.indexOf(device);
if (position == -1) { if (position == -1) {
notifyItemInserted(devices.size() - 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 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); final int position = devices.indexOf(device);
if (position >= 0) if (position >= 0)
notifyItemChanged(position); notifyItemChanged(position);
} }
public void onBatteryValueReceived(final BluetoothDevice device) { void onBatteryValueReceived(final BluetoothDevice device) {
final int position = devices.indexOf(device); final int position = devices.indexOf(device);
if (position >= 0) if (position >= 0)
notifyItemChanged(position); 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); final boolean ready = service.isReady(device);
String name = device.getName(); String name = device.getName();

View File

@@ -29,13 +29,13 @@ import androidx.appcompat.app.AlertDialog;
import no.nordicsemi.android.nrftoolbox.R; import no.nordicsemi.android.nrftoolbox.R;
public class LinkLossFragment extends DialogFragment { public class LinkLossDialogFragment extends DialogFragment {
private static final String ARG_NAME = "name"; private static final String ARG_NAME = "name";
private String name; private String name;
public static LinkLossFragment getInstance(String name) { public static LinkLossDialogFragment getInstance(@NonNull final String name) {
final LinkLossFragment fragment = new LinkLossFragment(); final LinkLossDialogFragment fragment = new LinkLossDialogFragment();
final Bundle args = new Bundle(); final Bundle args = new Bundle();
args.putString(ARG_NAME, name); args.putString(ARG_NAME, name);
@@ -48,7 +48,7 @@ public class LinkLossFragment extends DialogFragment {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
name = getArguments().getString(ARG_NAME); name = requireArguments().getString(ARG_NAME);
} }
@NonNull @NonNull

View File

@@ -159,7 +159,7 @@ public class ProximityActivity extends BleMulticonnectProfileServiceReadyActivit
private void showLinkLossDialog(final String name) { private void showLinkLossDialog(final String name) {
try { try {
final LinkLossFragment dialog = LinkLossFragment.getInstance(name); final LinkLossDialogFragment dialog = LinkLossDialogFragment.getInstance(name);
dialog.show(getSupportFragmentManager(), "scan_fragment"); dialog.show(getSupportFragmentManager(), "scan_fragment");
} catch (final Exception e) { } catch (final Exception e) {
// the activity must have been destroyed // the activity must have been destroyed

View File

@@ -53,14 +53,14 @@ public class RSCManager extends BatteryManager<RSCManagerCallbacks> {
@NonNull @NonNull
@Override @Override
protected BatteryManagerGattCallback getGattCallback() { protected BatteryManagerGattCallback getGattCallback() {
return gattCallback; return new RSCManagerGattCallback();
} }
/** /**
* BluetoothGatt callbacks for connection/disconnection, service discovery, * BluetoothGatt callbacks for connection/disconnection, service discovery,
* receiving indication, etc. * receiving indication, etc.
*/ */
private final BatteryManagerGattCallback gattCallback = new BatteryManagerGattCallback() { private class RSCManagerGattCallback extends BatteryManagerGattCallback {
@Override @Override
protected void initialize() { protected void initialize() {
@@ -99,5 +99,5 @@ public class RSCManager extends BatteryManager<RSCManagerCallbacks> {
super.onDeviceDisconnected(); super.onDeviceDisconnected();
rscMeasurementCharacteristic = null; rscMeasurementCharacteristic = null;
} }
}; }
} }

View File

@@ -24,7 +24,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context=".cgms.CGMSActivity"> tools:context=".cgm.CGMSActivity">
<include <include
android:id="@+id/toolbar_actionbar" android:id="@+id/toolbar_actionbar"

View File

@@ -24,7 +24,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context=".hrs.HRSActivity"> tools:context=".hr.HRActivity">
<include <include
android:id="@+id/toolbar_actionbar" android:id="@+id/toolbar_actionbar"

View File

@@ -24,7 +24,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context=".hts.HTSActivity"> tools:context=".ht.HTActivity">
<include <include
android:id="@+id/toolbar_actionbar" android:id="@+id/toolbar_actionbar"

View File

@@ -24,7 +24,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context=".hrs.HRSActivity"> tools:context=".hr.HRActivity">
<include <include
android:id="@+id/toolbar_actionbar" android:id="@+id/toolbar_actionbar"

View File

@@ -24,7 +24,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context=".hrs.HRSActivity"> tools:context=".hr.HRActivity">
<include <include
android:id="@+id/toolbar_actionbar" android:id="@+id/toolbar_actionbar"

View File

@@ -24,7 +24,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:context=".hts.HTSActivity"> tools:context=".ht.HTActivity">
<include <include
android:id="@+id/toolbar_actionbar" android:id="@+id/toolbar_actionbar"

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2015, Nordic Semiconductor ~ Copyright (c) 2015, Nordic Semiconductor
~ All rights reserved. ~ All rights reserved.
~ ~
@@ -21,10 +20,11 @@
~ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ~ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<androidx.appcompat.widget.Toolbar android:id="@+id/toolbar_actionbar" <com.google.android.material.appbar.MaterialToolbar
style="@style/HeaderBar"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar_actionbar"
style="@style/HeaderBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?actionBarSize" android:layout_height="?actionBarSize"
android:theme="@style/ActionBarThemeOverlay" android:theme="@style/ActionBarThemeOverlay"

View File

@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?><!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2015, Nordic Semiconductor ~ Copyright (c) 2015, Nordic Semiconductor
~ All rights reserved. ~ All rights reserved.
~ ~
@@ -21,11 +20,11 @@
~ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ~ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<androidx.appcompat.widget.Toolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar_actionbar"
style="@style/HeaderBar"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar_actionbar"
style="@style/HeaderBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?actionBarSize" android:layout_height="?actionBarSize"
android:theme="@style/ActionBarThemeOverlay" android:theme="@style/ActionBarThemeOverlay"
@@ -37,4 +36,4 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="48dp" android:layout_height="48dp"
android:minWidth="160dp" /> android:minWidth="160dp" />
</androidx.appcompat.widget.Toolbar> </com.google.android.material.appbar.MaterialToolbar>

View File

@@ -98,7 +98,7 @@
</style> </style>
<style name="Widget.Connect" parent="@style/Widget.MaterialComponents.Button"> <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:minWidth">200dp</item>
<item name="android:minHeight">52dp</item> <item name="android:minHeight">52dp</item>
</style> </style>

View File

@@ -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, // Uncomment these lines if you want to import the BLE Library and BLE Common Library as a project,
// not from jcenter: // not from jcenter:
// include ':ble', ':ble-common' include ':ble', ':ble-common'
// project(':ble').projectDir = file('../Android-BLE-Library/ble') project(':ble').projectDir = file('../Android-BLE-Library/ble')
// project(':ble-common').projectDir = file('../Android-BLE-Common-Library/ble-common') 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: // Uncomment these lines if you want to import the DFULibrary as a project, not from jcenter: