- merge RileyLink2 support from RileyLinkAAPS
This commit is contained in:
parent
da75ed643d
commit
70065c1343
|
@ -1,8 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCommon.dialog;
|
package info.nightscout.androidaps.plugins.PumpCommon.dialog;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -16,12 +20,11 @@ import android.bluetooth.le.ScanResult;
|
||||||
import android.bluetooth.le.ScanSettings;
|
import android.bluetooth.le.ScanSettings;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.os.ParcelUuid;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
@ -41,15 +44,21 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkConst;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkConst;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkUtil;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.GattAttributes;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.LocationHelper;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.LocationHelper;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(RileyLinkBLEScanActivity.class);
|
private static final Logger LOG = LoggerFactory.getLogger(RileyLinkBLEScanActivity.class);
|
||||||
|
|
||||||
private static final int PERMISSION_REQUEST_COARSE_LOCATION = 30241; // arbitrary.
|
private static final int PERMISSION_REQUEST_COARSE_LOCATION = 30241; // arbitrary.
|
||||||
private static final int REQUEST_ENABLE_BT = 30242; // arbitrary
|
private static final int REQUEST_ENABLE_BT = 30242; // arbitrary
|
||||||
// Stops scanning after 10 seconds.
|
|
||||||
|
private static String TAG = "RileyLinkBLEScanActivity";
|
||||||
|
|
||||||
|
// Stops scanning after 30 seconds.
|
||||||
private static final long SCAN_PERIOD = 30000;
|
private static final long SCAN_PERIOD = 30000;
|
||||||
public boolean mScanning;
|
public boolean mScanning;
|
||||||
public Snackbar snackbar;
|
public Snackbar snackbar;
|
||||||
|
@ -62,52 +71,6 @@ public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
private BluetoothLeScanner mLEScanner;
|
private BluetoothLeScanner mLEScanner;
|
||||||
private LeDeviceListAdapter mLeDeviceListAdapter;
|
private LeDeviceListAdapter mLeDeviceListAdapter;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
private ScanCallback mScanCallback = new ScanCallback() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onScanResult(int callbackType, ScanResult result) {
|
|
||||||
final BluetoothDevice device = result.getDevice();
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (device.getName() != null && device.getName().length() > 0) {
|
|
||||||
mLeDeviceListAdapter.addDevice(device);
|
|
||||||
mLeDeviceListAdapter.notifyDataSetChanged();
|
|
||||||
LOG.debug("Found BLE" + device.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBatchScanResults(final List<ScanResult> results) {
|
|
||||||
runOnUiThread(new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (ScanResult result : results) {
|
|
||||||
BluetoothDevice device = result.getDevice();
|
|
||||||
if (device.getName() != null && device.getName().length() > 0) {
|
|
||||||
mLeDeviceListAdapter.addDevice(device);
|
|
||||||
LOG.debug("Found BLE" + result.toString());
|
|
||||||
} else {
|
|
||||||
LOG.error("Found BLE, but name appears to be missing. Ignoring. " + device.getAddress());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mLeDeviceListAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onScanFailed(int errorCode) {
|
|
||||||
Log.e("Scan Failed", "Error Code: " + errorCode);
|
|
||||||
Toast.makeText(mContext, "Scan Failed " + errorCode, Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -131,6 +94,14 @@ public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
|
|
||||||
SP.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress);
|
SP.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress);
|
||||||
|
|
||||||
|
// Context applicationContext = MainApp.instance().getApplicationContext();
|
||||||
|
// applicationContext.get
|
||||||
|
|
||||||
|
// RileyLinkBLEScanActivity.this.findPreference("pref_key");
|
||||||
|
|
||||||
|
// EditTextPreference viewById =
|
||||||
|
// (EditTextPreference)super.findPreference(R.id.rileylink_mac_address_mdt);
|
||||||
|
|
||||||
// //Notify that we have a new rileylinkAddressKey
|
// //Notify that we have a new rileylinkAddressKey
|
||||||
// RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.INTENT_NEW_rileylinkAddressKey);
|
// RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.INTENT_NEW_rileylinkAddressKey);
|
||||||
//
|
//
|
||||||
|
@ -159,14 +130,13 @@ public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
protected void onPause() {
|
// protected void onPause() {
|
||||||
super.onPause();
|
// super.onPause();
|
||||||
scanLeDevice(false);
|
// scanLeDevice(false);
|
||||||
mLeDeviceListAdapter.clear();
|
// mLeDeviceListAdapter.clear();
|
||||||
mLeDeviceListAdapter.notifyDataSetChanged();
|
// mLeDeviceListAdapter.notifyDataSetChanged();
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
@ -179,7 +149,7 @@ public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.rileylink_miScan:
|
case R.id.rileylink_miScan:
|
||||||
startScanBLE();
|
scanLeDevice(true);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
@ -217,11 +187,14 @@ public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
|
|
||||||
mLEScanner = mBluetoothAdapter.getBluetoothLeScanner();
|
mLEScanner = mBluetoothAdapter.getBluetoothLeScanner();
|
||||||
settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
|
settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
|
||||||
filters = new ArrayList<ScanFilter>();
|
filters = Arrays.asList(new ScanFilter.Builder().setServiceUuid(
|
||||||
|
ParcelUuid.fromString(GattAttributes.SERVICE_RADIO)).build());
|
||||||
|
|
||||||
scanLeDevice(true);
|
scanLeDevice(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RileyLinkUtil.sendBroadcastMessage(RileyLinkConst.Intents.RileyLinkDisconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -238,16 +211,111 @@ public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ScanCallback mScanCallback2 = new ScanCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScanResult(int callbackType, final ScanResult scanRecord) {
|
||||||
|
|
||||||
|
// final BleAdvertisedData badata = RileyLinkUtil.parseAdertisedData(scanRecord);
|
||||||
|
|
||||||
|
Log.d(TAG, scanRecord.toString());
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (addDevice(scanRecord))
|
||||||
|
mLeDeviceListAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBatchScanResults(final List<ScanResult> results) {
|
||||||
|
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
boolean added = false;
|
||||||
|
|
||||||
|
for (ScanResult result : results) {
|
||||||
|
|
||||||
|
if (addDevice(result))
|
||||||
|
added = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (added)
|
||||||
|
mLeDeviceListAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private boolean addDevice(ScanResult result) {
|
||||||
|
|
||||||
|
BluetoothDevice device = result.getDevice();
|
||||||
|
|
||||||
|
// BluetoothClass bluetoothClass = device.getBluetoothClass();
|
||||||
|
//
|
||||||
|
// StringBuilder sb = new StringBuilder("Class: ");
|
||||||
|
// sb.append("MajorClass: " + bluetoothClass.getMajorDeviceClass());
|
||||||
|
// sb.append("DeviceClass: " + bluetoothClass.getDeviceClass());
|
||||||
|
// Log.d(TAG, sb.toString());
|
||||||
|
// FIXME remove most of code
|
||||||
|
List<ParcelUuid> serviceUuids = result.getScanRecord().getServiceUuids();
|
||||||
|
|
||||||
|
if (serviceUuids == null || serviceUuids.size() == 0) {
|
||||||
|
Log.v(TAG, "Device " + device.getAddress() + " has no serviceUuids (Not RileyLink).");
|
||||||
|
} else if (serviceUuids.size() > 1) {
|
||||||
|
Log.v(TAG, "Device " + device.getAddress() + " has too many serviceUuids (Not RileyLink).");
|
||||||
|
} else {
|
||||||
|
|
||||||
|
String uuid = serviceUuids.get(0).getUuid().toString().toLowerCase();
|
||||||
|
|
||||||
|
if (uuid.equals(GattAttributes.SERVICE_RADIO)) {
|
||||||
|
Log.i(TAG, "Found RileyLink with address: " + device.getAddress());
|
||||||
|
mLeDeviceListAdapter.addDevice(result);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
Log.v(TAG, "Device " + device.getAddress() + " has incorrect uuid (Not RileyLink).");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getDeviceDebug(BluetoothDevice device) {
|
||||||
|
|
||||||
|
return "BluetoothDevice [name=" + device.getName() + ", address=" + device.getAddress() + //
|
||||||
|
", type=" + device.getType(); // + ", alias=" + device.getAlias();
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public void onScanFailed(int errorCode) {
|
||||||
|
//
|
||||||
|
// Log.e("Scan Failed", "Error Code: " + errorCode);
|
||||||
|
// Toast.makeText(mContext, "Scan Failed " + errorCode, Toast.LENGTH_LONG).show();
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
private void scanLeDevice(final boolean enable) {
|
private void scanLeDevice(final boolean enable) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
|
|
||||||
|
mLeDeviceListAdapter.clear();
|
||||||
|
mLeDeviceListAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
// Stops scanning after a pre-defined scan period.
|
// Stops scanning after a pre-defined scan period.
|
||||||
mHandler.postDelayed(new Runnable() {
|
mHandler.postDelayed(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mScanning = false;
|
mScanning = false;
|
||||||
mLEScanner.stopScan(mScanCallback);
|
mLEScanner.stopScan(mScanCallback2);
|
||||||
LOG.debug("scanLeDevice: Scanning Stop");
|
LOG.debug("scanLeDevice: Scanning Stop");
|
||||||
// Toast.makeText(mContext, "Scanning finished", Toast.LENGTH_SHORT).show();
|
// Toast.makeText(mContext, "Scanning finished", Toast.LENGTH_SHORT).show();
|
||||||
snackbar.dismiss();
|
snackbar.dismiss();
|
||||||
|
@ -255,13 +323,13 @@ public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
}, SCAN_PERIOD);
|
}, SCAN_PERIOD);
|
||||||
|
|
||||||
mScanning = true;
|
mScanning = true;
|
||||||
mLEScanner.startScan(mScanCallback);
|
mLEScanner.startScan(filters, settings, mScanCallback2);
|
||||||
LOG.debug("scanLeDevice: Scanning Start");
|
LOG.debug("scanLeDevice: Scanning Start");
|
||||||
// Toast.makeText(this, "Scanning", Toast.LENGTH_SHORT).show();
|
// Toast.makeText(this, "Scanning", Toast.LENGTH_SHORT).show();
|
||||||
snackbar.show();
|
snackbar.show();
|
||||||
} else {
|
} else {
|
||||||
mScanning = false;
|
mScanning = false;
|
||||||
mLEScanner.stopScan(mScanCallback);
|
mLEScanner.stopScan(mScanCallback2);
|
||||||
|
|
||||||
LOG.debug("scanLeDevice: Scanning Stop");
|
LOG.debug("scanLeDevice: Scanning Stop");
|
||||||
// Toast.makeText(this, "Scanning finished", Toast.LENGTH_SHORT).show();
|
// Toast.makeText(this, "Scanning finished", Toast.LENGTH_SHORT).show();
|
||||||
|
@ -270,40 +338,49 @@ public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ViewHolder {
|
|
||||||
|
|
||||||
TextView deviceName;
|
|
||||||
TextView deviceAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class LeDeviceListAdapter extends BaseAdapter {
|
private class LeDeviceListAdapter extends BaseAdapter {
|
||||||
|
|
||||||
private ArrayList<BluetoothDevice> mLeDevices;
|
private ArrayList<BluetoothDevice> mLeDevices;
|
||||||
|
private Map<BluetoothDevice, Integer> rileyLinkDevices;
|
||||||
private LayoutInflater mInflator;
|
private LayoutInflater mInflator;
|
||||||
|
String currentlySelectedAddress;
|
||||||
|
|
||||||
|
|
||||||
public LeDeviceListAdapter() {
|
public LeDeviceListAdapter() {
|
||||||
super();
|
super();
|
||||||
mLeDevices = new ArrayList<>();
|
mLeDevices = new ArrayList<>();
|
||||||
|
rileyLinkDevices = new HashMap<>();
|
||||||
mInflator = RileyLinkBLEScanActivity.this.getLayoutInflater();
|
mInflator = RileyLinkBLEScanActivity.this.getLayoutInflater();
|
||||||
|
currentlySelectedAddress = SP.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addDevice(BluetoothDevice device) {
|
// public void addDevice(BluetoothDevice device) {
|
||||||
if (!mLeDevices.contains(device)) {
|
//
|
||||||
mLeDevices.add(device);
|
// if (!mLeDevices.contains(device)) {
|
||||||
|
// mLeDevices.add(device);
|
||||||
|
// notifyDataSetChanged();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
public void addDevice(ScanResult result) {
|
||||||
|
|
||||||
|
if (!mLeDevices.contains(result.getDevice())) {
|
||||||
|
mLeDevices.add(result.getDevice());
|
||||||
|
}
|
||||||
|
rileyLinkDevices.put(result.getDevice(), result.getRssi());
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public BluetoothDevice getDevice(int position) {
|
// public BluetoothDevice getDevice(int position) {
|
||||||
return mLeDevices.get(position);
|
//
|
||||||
}
|
// return rileyLinkDevices.get(position);
|
||||||
|
// }
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
mLeDevices.clear();
|
mLeDevices.clear();
|
||||||
|
rileyLinkDevices.clear();
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,6 +405,7 @@ public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||||
|
|
||||||
ViewHolder viewHolder;
|
ViewHolder viewHolder;
|
||||||
// General ListView optimization code.
|
// General ListView optimization code.
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
|
@ -342,17 +420,46 @@ public class RileyLinkBLEScanActivity extends AppCompatActivity {
|
||||||
|
|
||||||
BluetoothDevice device = mLeDevices.get(i);
|
BluetoothDevice device = mLeDevices.get(i);
|
||||||
String deviceName = device.getName();
|
String deviceName = device.getName();
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
|
||||||
if (SP.getString(RileyLinkConst.Prefs.RileyLinkAddress, "").compareTo(device.getAddress()) == 0) {
|
if (StringUtils.isBlank(deviceName)) {
|
||||||
|
deviceName = "RileyLink";
|
||||||
|
}
|
||||||
|
|
||||||
|
deviceName += " [" + rileyLinkDevices.get(device).intValue() + "]";
|
||||||
|
|
||||||
|
if (currentlySelectedAddress.equals(device.getAddress())) {
|
||||||
// viewHolder.deviceName.setTextColor(getColor(R.color.secondary_text_light));
|
// viewHolder.deviceName.setTextColor(getColor(R.color.secondary_text_light));
|
||||||
// viewHolder.deviceAddress.setTextColor(getColor(R.color.secondary_text_light));
|
// viewHolder.deviceAddress.setTextColor(getColor(R.color.secondary_text_light));
|
||||||
deviceName += " (" + getResources().getString(R.string.rileylink_scanner_selected_device) + ")";
|
deviceName += " (" + getResources().getString(R.string.rileylink_scanner_selected_device) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (deviceName == null) {
|
||||||
|
// BleAdvertisedData bleAdvertisedData = mapDevices.get(device);
|
||||||
|
//
|
||||||
|
// deviceName = bleAdvertisedData.getName();
|
||||||
|
//
|
||||||
|
// Log.d(TAG, "Old name was null so we replaced it with " + deviceName);
|
||||||
|
// }
|
||||||
|
|
||||||
viewHolder.deviceName.setText(deviceName);
|
viewHolder.deviceName.setText(deviceName);
|
||||||
viewHolder.deviceAddress.setText(device.getAddress());
|
viewHolder.deviceAddress.setText(device.getAddress());
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public void addDevice(BluetoothDevice device, BleAdvertisedData bleAdvertisedData) {
|
||||||
|
// if (!mLeDevices.contains(device)) {
|
||||||
|
// mLeDevices.add(device);
|
||||||
|
// mapDevices.put(device, bleAdvertisedData);
|
||||||
|
// notifyDataSetChanged();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
static class ViewHolder {
|
||||||
|
|
||||||
|
TextView deviceName;
|
||||||
|
TextView deviceAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import info.nightscout.utils.SP;
|
||||||
public abstract class RileyLinkCommunicationManager {
|
public abstract class RileyLinkCommunicationManager {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(RileyLinkCommunicationManager.class);
|
private static final Logger LOG = LoggerFactory.getLogger(RileyLinkCommunicationManager.class);
|
||||||
|
|
||||||
private static final int SCAN_TIMEOUT = 1500;
|
private static final int SCAN_TIMEOUT = 1500;
|
||||||
protected final RFSpy rfspy;
|
protected final RFSpy rfspy;
|
||||||
protected final Context context;
|
protected final Context context;
|
||||||
|
@ -40,12 +41,12 @@ public abstract class RileyLinkCommunicationManager {
|
||||||
protected PumpStatus pumpStatus;
|
protected PumpStatus pumpStatus;
|
||||||
protected RileyLinkServiceData rileyLinkServiceData;
|
protected RileyLinkServiceData rileyLinkServiceData;
|
||||||
protected RileyLinkTargetFrequency targetFrequency;
|
protected RileyLinkTargetFrequency targetFrequency;
|
||||||
|
private long nextWakeUpRequired = 0L;
|
||||||
private double[] scanFrequencies;
|
private double[] scanFrequencies;
|
||||||
|
|
||||||
// internal flag
|
// internal flag
|
||||||
private boolean showPumpMessages = true;
|
private boolean showPumpMessages = true;
|
||||||
private int timeoutCount = 0;
|
private int timeoutCount = 0;
|
||||||
private long nextWakeUpRequired = 0L;
|
|
||||||
|
|
||||||
|
|
||||||
public RileyLinkCommunicationManager(Context context, RFSpy rfspy, RileyLinkTargetFrequency targetFrequency) {
|
public RileyLinkCommunicationManager(Context context, RFSpy rfspy, RileyLinkTargetFrequency targetFrequency) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ public class RileyLinkConst {
|
||||||
|
|
||||||
public static final String INTENT_NEW_rileylinkAddressKey = Prefix + "INTENT_NEW_rileylinkAddressKey";
|
public static final String INTENT_NEW_rileylinkAddressKey = Prefix + "INTENT_NEW_rileylinkAddressKey";
|
||||||
public static final String INTENT_NEW_pumpIDKey = Prefix + "INTENT_NEW_pumpIDKey";
|
public static final String INTENT_NEW_pumpIDKey = Prefix + "INTENT_NEW_pumpIDKey";
|
||||||
|
public static final String RileyLinkDisconnect = Prefix + "RileyLink_Disconnect";
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Prefs {
|
public class Prefs {
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink;
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -12,7 +16,9 @@ import android.support.v4.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RileyLinkBLE;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RileyLinkBLE;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkEncodingType;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.data.BleAdvertisedData;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.data.RLHistoryItem;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.data.RLHistoryItem;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkError;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkError;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkServiceState;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkServiceState;
|
||||||
|
@ -44,12 +50,12 @@ public class RileyLinkUtil {
|
||||||
private static RileyLinkService rileyLinkService;
|
private static RileyLinkService rileyLinkService;
|
||||||
// private static RileyLinkIPCConnection rileyLinkIPCConnection;
|
// private static RileyLinkIPCConnection rileyLinkIPCConnection;
|
||||||
private static MedtronicDeviceType medtronicPumpModel;
|
private static MedtronicDeviceType medtronicPumpModel;
|
||||||
// private static MedtronicPumpStatus pumpStatus;
|
|
||||||
// BAD dependencies in Classes: RileyLinkService
|
// BAD dependencies in Classes: RileyLinkService
|
||||||
private static RileyLinkTargetFrequency rileyLinkTargetFrequency;
|
private static RileyLinkTargetFrequency rileyLinkTargetFrequency;
|
||||||
|
|
||||||
// Broadcasts: RileyLinkBLE, RileyLinkService,
|
// Broadcasts: RileyLinkBLE, RileyLinkService,
|
||||||
private static RileyLinkTargetDevice targetDevice;
|
private static RileyLinkTargetDevice targetDevice;
|
||||||
|
private static RileyLinkEncodingType encoding;
|
||||||
|
|
||||||
|
|
||||||
public static void setContext(Context contextIn) {
|
public static void setContext(Context contextIn) {
|
||||||
|
@ -57,6 +63,17 @@ public class RileyLinkUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static RileyLinkEncodingType getEncoding() {
|
||||||
|
return encoding;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void setEncoding(RileyLinkEncodingType encoding) {
|
||||||
|
RileyLinkUtil.encoding = encoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void sendBroadcastMessage(String message) {
|
public static void sendBroadcastMessage(String message) {
|
||||||
Intent intent = new Intent(message);
|
Intent intent = new Intent(message);
|
||||||
LocalBroadcastManager.getInstance(RileyLinkUtil.context).sendBroadcast(intent);
|
LocalBroadcastManager.getInstance(RileyLinkUtil.context).sendBroadcast(intent);
|
||||||
|
@ -197,6 +214,56 @@ public class RileyLinkUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static BleAdvertisedData parseAdertisedData(byte[] advertisedData) {
|
||||||
|
List<UUID> uuids = new ArrayList<UUID>();
|
||||||
|
String name = null;
|
||||||
|
if (advertisedData == null) {
|
||||||
|
return new BleAdvertisedData(uuids, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteBuffer buffer = ByteBuffer.wrap(advertisedData).order(ByteOrder.LITTLE_ENDIAN);
|
||||||
|
while (buffer.remaining() > 2) {
|
||||||
|
byte length = buffer.get();
|
||||||
|
if (length == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
byte type = buffer.get();
|
||||||
|
switch (type) {
|
||||||
|
case 0x02: // Partial list of 16-bit UUIDs
|
||||||
|
case 0x03: // Complete list of 16-bit UUIDs
|
||||||
|
while (length >= 2) {
|
||||||
|
uuids
|
||||||
|
.add(UUID.fromString(String.format("%08x-0000-1000-8000-00805f9b34fb", buffer.getShort())));
|
||||||
|
length -= 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x06: // Partial list of 128-bit UUIDs
|
||||||
|
case 0x07: // Complete list of 128-bit UUIDs
|
||||||
|
while (length >= 16) {
|
||||||
|
long lsb = buffer.getLong();
|
||||||
|
long msb = buffer.getLong();
|
||||||
|
uuids.add(new UUID(msb, lsb));
|
||||||
|
length -= 16;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x09:
|
||||||
|
byte[] nameBytes = new byte[length - 1];
|
||||||
|
buffer.get(nameBytes);
|
||||||
|
try {
|
||||||
|
name = new String(nameBytes, "utf-8");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
buffer.position(buffer.position() + length - 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new BleAdvertisedData(uuids, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<RLHistoryItem> getRileyLinkHistory() {
|
public static List<RLHistoryItem> getRileyLinkHistory() {
|
||||||
return historyRileyLink;
|
return historyRileyLink;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,19 @@ import org.slf4j.LoggerFactory;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkUtil;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command.RileyLinkCommand;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command.SendAndListen;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command.SetPreamble;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command.SetSoftwareEncoding;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command.UpdateRegister;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.GattAttributes;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.GattAttributes;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.RFSpyResponse;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.RFSpyResponse;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.RadioPacket;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.RadioPacket;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.RadioResponse;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.CC111XRegister;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.CC111XRegister;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RFSpyCommand;
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RXFilterMode;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RXFilterMode;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkCommandType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkEncodingType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.operations.BLECommOperationResult;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.operations.BLECommOperationResult;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
||||||
|
@ -38,6 +44,8 @@ public class RFSpy {
|
||||||
private UUID radioDataUUID = UUID.fromString(GattAttributes.CHARA_RADIO_DATA);
|
private UUID radioDataUUID = UUID.fromString(GattAttributes.CHARA_RADIO_DATA);
|
||||||
private UUID radioVersionUUID = UUID.fromString(GattAttributes.CHARA_RADIO_VERSION);
|
private UUID radioVersionUUID = UUID.fromString(GattAttributes.CHARA_RADIO_VERSION);
|
||||||
private UUID responseCountUUID = UUID.fromString(GattAttributes.CHARA_RADIO_RESPONSE_COUNT);
|
private UUID responseCountUUID = UUID.fromString(GattAttributes.CHARA_RADIO_RESPONSE_COUNT);
|
||||||
|
private RileyLinkFirmwareVersion firmwareVersion;
|
||||||
|
private String bleVersion; // We don't use it so no need of sofisticated logic
|
||||||
|
|
||||||
|
|
||||||
public RFSpy(RileyLinkBLE rileyLinkBle) {
|
public RFSpy(RileyLinkBLE rileyLinkBle) {
|
||||||
|
@ -46,6 +54,16 @@ public class RFSpy {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public RileyLinkFirmwareVersion getRLVersionCached() {
|
||||||
|
return firmwareVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getBLEVersionCached() {
|
||||||
|
return bleVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Call this after the RL services are discovered.
|
// Call this after the RL services are discovered.
|
||||||
// Starts an async task to read when data is available
|
// Starts an async task to read when data is available
|
||||||
public void startReader() {
|
public void startReader() {
|
||||||
|
@ -60,6 +78,27 @@ public class RFSpy {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Here should go generic RL initialisation + protocol adjustments depending on
|
||||||
|
// firmware version
|
||||||
|
public void initializeRileyLink() {
|
||||||
|
// We have to call raw version of communication to get firmware version
|
||||||
|
// So that we can adjust other commands accordingly afterwords
|
||||||
|
byte[] getVersionRaw = getByteArray(RileyLinkCommandType.GetVersion.code);
|
||||||
|
byte[] response = writeToDataRaw(getVersionRaw, 5000);
|
||||||
|
if (response != null) { // && response[0] == (byte) 0xDD) {
|
||||||
|
|
||||||
|
// This throws an exception if version not supported, we should treat exceptions somehow
|
||||||
|
// and show "Not supported firmware" message in UI
|
||||||
|
RileyLinkFirmwareVersion version = RileyLinkFirmwareVersion.getByVersionString(StringUtil
|
||||||
|
.fromBytes(response));
|
||||||
|
|
||||||
|
this.firmwareVersion = version;
|
||||||
|
|
||||||
|
}
|
||||||
|
bleVersion = getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Call this from the "response count" notification handler.
|
// Call this from the "response count" notification handler.
|
||||||
public void newDataIsAvailable() {
|
public void newDataIsAvailable() {
|
||||||
// pass the message to the reader (which should be internal to RFSpy)
|
// pass the message to the reader (which should be internal to RFSpy)
|
||||||
|
@ -80,22 +119,7 @@ public class RFSpy {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getRadioVersion() {
|
private byte[] writeToDataRaw(byte[] bytes, int responseTimeout_ms) {
|
||||||
RFSpyResponse resp = writeToData(RFSpyCommand.GetVersion, null, EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
|
|
||||||
if (resp == null) {
|
|
||||||
LOG.error("getRadioVersion returned null");
|
|
||||||
return "(null)";
|
|
||||||
} else {
|
|
||||||
return StringUtil.fromBytes(resp.getRadioResponse().decodedPayload);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// The caller has to know how long the RFSpy will be busy with what was sent to it.
|
|
||||||
private RFSpyResponse writeToData(RFSpyCommand command, byte[] body, int responseTimeout_ms) {
|
|
||||||
|
|
||||||
byte[] bytes = getCommandArray(command, body);
|
|
||||||
|
|
||||||
SystemClock.sleep(100);
|
SystemClock.sleep(100);
|
||||||
// FIXME drain read queue?
|
// FIXME drain read queue?
|
||||||
byte[] junkInBuffer = reader.poll(0);
|
byte[] junkInBuffer = reader.poll(0);
|
||||||
|
@ -109,17 +133,28 @@ public class RFSpy {
|
||||||
// prepend length, and send it.
|
// prepend length, and send it.
|
||||||
byte[] prepended = ByteUtil.concat(new byte[] { (byte)(bytes.length) }, bytes);
|
byte[] prepended = ByteUtil.concat(new byte[] { (byte)(bytes.length) }, bytes);
|
||||||
|
|
||||||
//LOG.debug("writeToData (command={},raw={})", command.name(), HexDump.toHexStringDisplayable(prepended));
|
LOG.debug("writeToData (raw={})", HexDump.toHexStringDisplayable(prepended));
|
||||||
|
|
||||||
BLECommOperationResult writeCheck = rileyLinkBle.writeCharacteristic_blocking(radioServiceUUID, radioDataUUID,
|
BLECommOperationResult writeCheck = rileyLinkBle.writeCharacteristic_blocking(radioServiceUUID, radioDataUUID,
|
||||||
prepended);
|
prepended);
|
||||||
if (writeCheck.resultCode != BLECommOperationResult.RESULT_SUCCESS) {
|
if (writeCheck.resultCode != BLECommOperationResult.RESULT_SUCCESS) {
|
||||||
LOG.error("BLE Write operation failed, code=" + writeCheck.resultCode);
|
LOG.error("BLE Write operation failed, code=" + writeCheck.resultCode);
|
||||||
return new RFSpyResponse(); // will be a null (invalid) response
|
return null; // will be a null (invalid) response
|
||||||
}
|
}
|
||||||
SystemClock.sleep(100);
|
SystemClock.sleep(100);
|
||||||
// Log.i(TAG,ThreadUtil.sig()+String.format(" writeToData:(timeout %d) %s",(responseTimeout_ms),ByteUtil.shortHexString(prepended)));
|
// Log.i(TAG,ThreadUtil.sig()+String.format(" writeToData:(timeout %d) %s",(responseTimeout_ms),ByteUtil.shortHexString(prepended)));
|
||||||
byte[] rawResponse = reader.poll(responseTimeout_ms);
|
byte[] rawResponse = reader.poll(responseTimeout_ms);
|
||||||
|
return rawResponse;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// The caller has to know how long the RFSpy will be busy with what was sent to it.
|
||||||
|
private RFSpyResponse writeToData(RileyLinkCommand command, int responseTimeout_ms) {
|
||||||
|
|
||||||
|
byte[] bytes = command.getRaw();
|
||||||
|
byte[] rawResponse = writeToDataRaw(bytes, responseTimeout_ms);
|
||||||
|
|
||||||
RFSpyResponse resp = new RFSpyResponse(command, rawResponse);
|
RFSpyResponse resp = new RFSpyResponse(command, rawResponse);
|
||||||
if (rawResponse == null) {
|
if (rawResponse == null) {
|
||||||
LOG.error("writeToData: No response from RileyLink");
|
LOG.error("writeToData: No response from RileyLink");
|
||||||
|
@ -135,9 +170,9 @@ public class RFSpy {
|
||||||
resetNotConnectedCount();
|
resetNotConnectedCount();
|
||||||
} else {
|
} else {
|
||||||
if (resp.looksLikeRadioPacket()) {
|
if (resp.looksLikeRadioPacket()) {
|
||||||
RadioResponse radioResp = resp.getRadioResponse();
|
// RadioResponse radioResp = resp.getRadioResponse();
|
||||||
byte[] responsePayload = radioResp.getPayload();
|
// byte[] responsePayload = radioResp.getPayload();
|
||||||
LOG.info("writeToData: decoded radio response is " + ByteUtil.shortHexString(responsePayload));
|
LOG.info("writeToData: received radio response. Will decode at upper level");
|
||||||
resetNotConnectedCount();
|
resetNotConnectedCount();
|
||||||
}
|
}
|
||||||
// Log.i(TAG, "writeToData: raw response is " + ByteUtil.shortHexString(rawResponse));
|
// Log.i(TAG, "writeToData: raw response is " + ByteUtil.shortHexString(rawResponse));
|
||||||
|
@ -157,7 +192,7 @@ public class RFSpy {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private byte[] getCommandArray(RFSpyCommand command, byte[] body) {
|
private byte[] getCommandArray(RileyLinkCommandType command, byte[] body) {
|
||||||
int bodyLength = body == null ? 0 : body.length;
|
int bodyLength = body == null ? 0 : body.length;
|
||||||
|
|
||||||
byte[] output = new byte[bodyLength + 1];
|
byte[] output = new byte[bodyLength + 1];
|
||||||
|
@ -174,27 +209,38 @@ public class RFSpy {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public RFSpyResponse transmit(RadioPacket radioPacket) {
|
// public RFSpyResponse transmit(RadioPacket radioPacket) {
|
||||||
|
//
|
||||||
|
// return transmit(radioPacket, (byte) 0, (byte) 0, (byte) 0xFF);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public RFSpyResponse transmit(RadioPacket radioPacket, byte sendChannel, byte repeatCount, byte delay_ms) {
|
||||||
|
// // append checksum, encode data, send it.
|
||||||
|
// byte[] fullPacket = ByteUtil.concat(getByteArray(sendChannel, repeatCount, delay_ms), radioPacket.getEncoded());
|
||||||
|
// RFSpyResponse response = writeToData(RileyLinkCommandType.Send, fullPacket, delay_ms +
|
||||||
|
// EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
|
||||||
|
// return response;
|
||||||
|
// }
|
||||||
|
|
||||||
return transmit(radioPacket, (byte)0, (byte)0, (byte)0xFF);
|
// public RFSpyResponse receive(byte listenChannel, int timeout_ms, byte retryCount) {
|
||||||
}
|
// int receiveDelay = timeout_ms * (retryCount + 1);
|
||||||
|
// byte[] listen = getByteArray(listenChannel, (byte) ((timeout_ms >> 24) & 0x0FF), (byte) ((timeout_ms >> 16) &
|
||||||
|
// 0x0FF), (byte) ((timeout_ms >> 8) & 0x0FF), (byte) (timeout_ms & 0x0FF), retryCount);
|
||||||
|
// return writeToData(RileyLinkCommandType.GetPacket, listen, receiveDelay);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public RFSpyResponse transmitThenReceive(RadioPacket pkt, int timeout_ms) {
|
||||||
|
// return transmitThenReceive(pkt, (byte) 0, (byte) 0, (byte) 0, (byte) 0, timeout_ms, (byte) 0);
|
||||||
|
// }
|
||||||
|
// public RFSpyResponse transmitThenReceive(RadioPacket pkt, int timeout_ms, int repeatCount, int extendPreamble_ms)
|
||||||
|
// {
|
||||||
|
// return transmitThenReceive(pkt, (byte) 0, (byte) repeatCount, (byte) 0, (byte) 0, timeout_ms, (byte) 0);
|
||||||
|
// }
|
||||||
|
|
||||||
public RFSpyResponse transmit(RadioPacket radioPacket, byte sendChannel, byte repeatCount, byte delay_ms) {
|
public RFSpyResponse transmitThenReceive(RadioPacket pkt, byte sendChannel, byte repeatCount, byte delay_ms,
|
||||||
// append checksum, encode data, send it.
|
byte listenChannel, int timeout_ms, byte retryCount) {
|
||||||
byte[] fullPacket = ByteUtil.concat(getByteArray(sendChannel, repeatCount, delay_ms), radioPacket.getEncoded());
|
return transmitThenReceive(pkt, sendChannel, repeatCount, delay_ms, listenChannel, timeout_ms, retryCount, null);
|
||||||
RFSpyResponse response = writeToData(RFSpyCommand.Send, fullPacket, delay_ms
|
|
||||||
+ EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public RFSpyResponse receive(byte listenChannel, int timeout_ms, byte retryCount) {
|
|
||||||
int receiveDelay = timeout_ms * (retryCount + 1);
|
|
||||||
byte[] listen = getByteArray(listenChannel, (byte)((timeout_ms >> 24) & 0x0FF),
|
|
||||||
(byte)((timeout_ms >> 16) & 0x0FF), (byte)((timeout_ms >> 8) & 0x0FF), (byte)(timeout_ms & 0x0FF),
|
|
||||||
retryCount);
|
|
||||||
return writeToData(RFSpyCommand.GetPacket, listen, receiveDelay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -203,23 +249,24 @@ public class RFSpy {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME: to be able to work with Omnipod we need to support preamble extensions so we should create a class for the
|
||||||
|
// SnedAndListen RL command
|
||||||
|
// To avoid snedAndListen command assembly magic
|
||||||
public RFSpyResponse transmitThenReceive(RadioPacket pkt, byte sendChannel, byte repeatCount, byte delay_ms,
|
public RFSpyResponse transmitThenReceive(RadioPacket pkt, byte sendChannel, byte repeatCount, byte delay_ms,
|
||||||
byte listenChannel, int timeout_ms, byte retryCount) {
|
byte listenChannel, int timeout_ms, byte retryCount, Integer extendPreamble_ms) {
|
||||||
|
|
||||||
int sendDelay = repeatCount * delay_ms;
|
int sendDelay = repeatCount * delay_ms;
|
||||||
int receiveDelay = timeout_ms * (retryCount + 1);
|
int receiveDelay = timeout_ms * (retryCount + 1);
|
||||||
byte[] sendAndListen = getByteArray(sendChannel, repeatCount, delay_ms, listenChannel,
|
|
||||||
(byte)((timeout_ms >> 24) & 0x0FF), (byte)((timeout_ms >> 16) & 0x0FF), (byte)((timeout_ms >> 8) & 0x0FF),
|
SendAndListen command = new SendAndListen(firmwareVersion, sendChannel, repeatCount, delay_ms, listenChannel,
|
||||||
(byte)(timeout_ms & 0x0FF), (byte)retryCount);
|
timeout_ms, retryCount, extendPreamble_ms, pkt);
|
||||||
byte[] fullPacket = ByteUtil.concat(sendAndListen, pkt.getEncoded());
|
|
||||||
return writeToData(RFSpyCommand.SendAndListen, fullPacket, sendDelay + receiveDelay
|
return writeToData(command, sendDelay + receiveDelay + EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
|
||||||
+ EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public RFSpyResponse updateRegister(CC111XRegister reg, int val) {
|
public RFSpyResponse updateRegister(CC111XRegister reg, int val) {
|
||||||
byte[] updateRegisterPkt = getByteArray(reg.value, (byte)val);
|
RFSpyResponse resp = writeToData(new UpdateRegister(firmwareVersion, reg, (byte)val),
|
||||||
RFSpyResponse resp = writeToData(RFSpyCommand.UpdateRegister, updateRegisterPkt,
|
|
||||||
EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
|
EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
@ -244,32 +291,64 @@ public class RFSpy {
|
||||||
|
|
||||||
switch (frequency) {
|
switch (frequency) {
|
||||||
case Medtronic_WorldWide: {
|
case Medtronic_WorldWide: {
|
||||||
|
// updateRegister(CC111X_MDMCFG4, (byte) 0x59);
|
||||||
setRXFilterMode(RXFilterMode.Wide);
|
setRXFilterMode(RXFilterMode.Wide);
|
||||||
// updateRegister(CC111X_MDMCFG3, (byte) 0x66);
|
// updateRegister(CC111X_MDMCFG3, (byte) 0x66);
|
||||||
// updateRegister(CC111X_MDMCFG2, (byte) 0x33);
|
// updateRegister(CC111X_MDMCFG2, (byte) 0x33);
|
||||||
updateRegister(CC111XRegister.mdmcfg1, 0x62);
|
updateRegister(CC111XRegister.mdmcfg1, 0x62);
|
||||||
updateRegister(CC111XRegister.mdmcfg0, 0x1A);
|
updateRegister(CC111XRegister.mdmcfg0, 0x1A);
|
||||||
updateRegister(CC111XRegister.deviatn, 0x13);
|
updateRegister(CC111XRegister.deviatn, 0x13);
|
||||||
|
// RileyLinkUtil.setEncoding(RileyLinkEncodingType.FourByteSixByte);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Medtronic_US: {
|
case Medtronic_US: {
|
||||||
|
// updateRegister(CC111X_MDMCFG4, (byte) 0x99);
|
||||||
setRXFilterMode(RXFilterMode.Narrow);
|
setRXFilterMode(RXFilterMode.Narrow);
|
||||||
// updateRegister(CC111X_MDMCFG3, (byte) 0x66);
|
// updateRegister(CC111X_MDMCFG3, (byte) 0x66);
|
||||||
// updateRegister(CC111X_MDMCFG2, (byte) 0x33);
|
// updateRegister(CC111X_MDMCFG2, (byte) 0x33);
|
||||||
updateRegister(CC111XRegister.mdmcfg1, 0x61);
|
updateRegister(CC111XRegister.mdmcfg1, 0x61);
|
||||||
updateRegister(CC111XRegister.mdmcfg0, 0x7E);
|
updateRegister(CC111XRegister.mdmcfg0, 0x7E);
|
||||||
updateRegister(CC111XRegister.deviatn, 0x15);
|
updateRegister(CC111XRegister.deviatn, 0x15);
|
||||||
|
// RileyLinkUtil.setEncoding(RileyLinkEncodingType.FourByteSixByte);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Omnipod: {
|
case Omnipod: {
|
||||||
LOG.debug("No region configuration for RfSpy and {}", frequency.name());
|
RFSpyResponse r = null;
|
||||||
}
|
// RL initialization for Omnipod is a copy/paste from OmniKit implementation.
|
||||||
|
// Last commit from original repository: 5c3beb4144
|
||||||
|
// so if something is terribly wrong, please check git diff PodCommsSession.swift since that commit
|
||||||
|
r = updateRegister(CC111XRegister.pktctrl1, 0x20);
|
||||||
|
r = updateRegister(CC111XRegister.agcctrl0, 0x00);
|
||||||
|
r = updateRegister(CC111XRegister.fsctrl1, 0x06);
|
||||||
|
r = updateRegister(CC111XRegister.mdmcfg4, 0xCA);
|
||||||
|
r = updateRegister(CC111XRegister.mdmcfg3, 0xBC);
|
||||||
|
r = updateRegister(CC111XRegister.mdmcfg2, 0x06);
|
||||||
|
r = updateRegister(CC111XRegister.mdmcfg1, 0x70);
|
||||||
|
r = updateRegister(CC111XRegister.mdmcfg0, 0x11);
|
||||||
|
r = updateRegister(CC111XRegister.deviatn, 0x44);
|
||||||
|
r = updateRegister(CC111XRegister.mcsm0, 0x18);
|
||||||
|
r = updateRegister(CC111XRegister.foccfg, 0x17);
|
||||||
|
r = updateRegister(CC111XRegister.fscal3, 0xE9);
|
||||||
|
r = updateRegister(CC111XRegister.fscal2, 0x2A);
|
||||||
|
r = updateRegister(CC111XRegister.fscal1, 0x00);
|
||||||
|
r = updateRegister(CC111XRegister.fscal0, 0x1F);
|
||||||
|
|
||||||
|
r = updateRegister(CC111XRegister.test1, 0x31);
|
||||||
|
r = updateRegister(CC111XRegister.test0, 0x09);
|
||||||
|
r = updateRegister(CC111XRegister.paTable0, 0x84);
|
||||||
|
r = updateRegister(CC111XRegister.sync1, 0xA5);
|
||||||
|
r = updateRegister(CC111XRegister.sync0, 0x5A);
|
||||||
|
|
||||||
|
r = setSoftwareEncoding(RileyLinkEncodingType.Manchester);
|
||||||
|
// RileyLinkUtil.setEncoding(RileyLinkEncodingType.Manchester);
|
||||||
|
r = setPreamble(0x6665);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// no configuration
|
LOG.debug("No region configuration for RfSpy and {}", frequency.name());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -278,6 +357,24 @@ public class RFSpy {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private RFSpyResponse setPreamble(int preamble) {
|
||||||
|
RFSpyResponse resp = null;
|
||||||
|
try {
|
||||||
|
resp = writeToData(new SetPreamble(firmwareVersion, preamble), EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.toString();
|
||||||
|
}
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private RFSpyResponse setSoftwareEncoding(RileyLinkEncodingType encoding) {
|
||||||
|
RFSpyResponse resp = writeToData(new SetSoftwareEncoding(firmwareVersion, encoding),
|
||||||
|
EXPECTED_MAX_BLUETOOTH_LATENCY_MS);
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setRXFilterMode(RXFilterMode mode) {
|
private void setRXFilterMode(RXFilterMode mode) {
|
||||||
|
|
||||||
byte drate_e = (byte)0x9; // exponent of symbol rate (16kbps)
|
byte drate_e = (byte)0x9; // exponent of symbol rate (16kbps)
|
||||||
|
|
|
@ -11,7 +11,9 @@ import org.slf4j.LoggerFactory;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.GattAttributes;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.GattAttributes;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkEncodingType;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.operations.BLECommOperationResult;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.operations.BLECommOperationResult;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.ThreadUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.ThreadUtil;
|
||||||
|
@ -22,7 +24,7 @@ import info.nightscout.androidaps.plugins.PumpCommon.utils.ThreadUtil;
|
||||||
public class RFSpyReader {
|
public class RFSpyReader {
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(RFSpyReader.class);
|
private static final Logger LOG = LoggerFactory.getLogger(RFSpyReader.class);
|
||||||
AsyncTask<Void, Void, Void> readerTask;
|
private static AsyncTask<Void, Void, Void> readerTask;
|
||||||
// private Context context;
|
// private Context context;
|
||||||
private RileyLinkBLE rileyLinkBle;
|
private RileyLinkBLE rileyLinkBle;
|
||||||
private Semaphore waitForRadioData = new Semaphore(0, true);
|
private Semaphore waitForRadioData = new Semaphore(0, true);
|
||||||
|
@ -92,6 +94,9 @@ public class RFSpyReader {
|
||||||
UUID serviceUUID = UUID.fromString(GattAttributes.SERVICE_RADIO);
|
UUID serviceUUID = UUID.fromString(GattAttributes.SERVICE_RADIO);
|
||||||
UUID radioDataUUID = UUID.fromString(GattAttributes.CHARA_RADIO_DATA);
|
UUID radioDataUUID = UUID.fromString(GattAttributes.CHARA_RADIO_DATA);
|
||||||
BLECommOperationResult result;
|
BLECommOperationResult result;
|
||||||
|
boolean stopAtNull = true;
|
||||||
|
if (RileyLinkUtil.getEncoding() == RileyLinkEncodingType.Manchester)
|
||||||
|
stopAtNull = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
acquireCount++;
|
acquireCount++;
|
||||||
|
@ -104,6 +109,7 @@ public class RFSpyReader {
|
||||||
SystemClock.sleep(100);
|
SystemClock.sleep(100);
|
||||||
|
|
||||||
if (result.resultCode == BLECommOperationResult.RESULT_SUCCESS) {
|
if (result.resultCode == BLECommOperationResult.RESULT_SUCCESS) {
|
||||||
|
if (stopAtNull) {
|
||||||
// only data up to the first null is valid
|
// only data up to the first null is valid
|
||||||
for (int i = 0; i < result.value.length; i++) {
|
for (int i = 0; i < result.value.length; i++) {
|
||||||
if (result.value[i] == 0) {
|
if (result.value[i] == 0) {
|
||||||
|
@ -111,6 +117,7 @@ public class RFSpyReader {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mDataQueue.add(result.value);
|
mDataQueue.add(result.value);
|
||||||
} else if (result.resultCode == BLECommOperationResult.RESULT_INTERRUPTED) {
|
} else if (result.resultCode == BLECommOperationResult.RESULT_INTERRUPTED) {
|
||||||
LOG.error("Read operation was interrupted");
|
LOG.error("Read operation was interrupted");
|
||||||
|
|
|
@ -115,6 +115,7 @@ public class RileyLinkBLE {
|
||||||
if (status == 133) {
|
if (status == 133) {
|
||||||
LOG.error("Got the status 133 bug, closing gatt");
|
LOG.error("Got the status 133 bug, closing gatt");
|
||||||
disconnect();
|
disconnect();
|
||||||
|
SystemClock.sleep(500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,6 +364,7 @@ public class RileyLinkBLE {
|
||||||
// This function must be run on UI thread.
|
// This function must be run on UI thread.
|
||||||
public void connectGatt() {
|
public void connectGatt() {
|
||||||
bluetoothConnectionGatt = rileyLinkDevice.connectGatt(context, true, bluetoothGattCallback);
|
bluetoothConnectionGatt = rileyLinkDevice.connectGatt(context, true, bluetoothGattCallback);
|
||||||
|
// , BluetoothDevice.TRANSPORT_LE
|
||||||
if (bluetoothConnectionGatt == null) {
|
if (bluetoothConnectionGatt == null) {
|
||||||
LOG.error("Failed to connect to Bluetooth Low Energy device at " + bluetoothAdapter.getAddress());
|
LOG.error("Failed to connect to Bluetooth Low Energy device at " + bluetoothAdapter.getAddress());
|
||||||
Toast.makeText(context, "No Rileylink at " + bluetoothAdapter.getAddress(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "No Rileylink at " + bluetoothAdapter.getAddress(), Toast.LENGTH_SHORT).show();
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkCommandType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
|
|
||||||
|
public class GetVersion extends RileyLinkCommand {
|
||||||
|
|
||||||
|
public GetVersion(RileyLinkFirmwareVersion version) {
|
||||||
|
super(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RileyLinkCommandType getCommandType() {
|
||||||
|
return RileyLinkCommandType.GetVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] getRaw() {
|
||||||
|
return super.getRawSimple();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkCommandType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
|
|
||||||
|
public abstract class RileyLinkCommand {
|
||||||
|
|
||||||
|
protected RileyLinkFirmwareVersion version;
|
||||||
|
|
||||||
|
|
||||||
|
public RileyLinkCommand(RileyLinkFirmwareVersion version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public abstract RileyLinkCommandType getCommandType();
|
||||||
|
|
||||||
|
|
||||||
|
public abstract byte[] getRaw();
|
||||||
|
|
||||||
|
|
||||||
|
protected byte[] getRawSimple() {
|
||||||
|
return getByteArray(getCommandType().code);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected byte[] getByteArray(byte... input) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data.RadioPacket;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkCommandType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
||||||
|
|
||||||
|
public class SendAndListen extends RileyLinkCommand {
|
||||||
|
|
||||||
|
private byte sendChannel;
|
||||||
|
private byte repeatCount;
|
||||||
|
private int delayBetweenPackets_ms;
|
||||||
|
private byte listenChannel;
|
||||||
|
private int timeout_ms;
|
||||||
|
private byte retryCount;
|
||||||
|
private Integer preambleExtension_ms;
|
||||||
|
private RadioPacket packetToSend;
|
||||||
|
|
||||||
|
|
||||||
|
public SendAndListen(RileyLinkFirmwareVersion version, byte sendChannel, byte repeatCount,
|
||||||
|
byte delayBetweenPackets_ms, byte listenChannel, int timeout_ms, byte retryCount, RadioPacket packetToSend
|
||||||
|
|
||||||
|
) {
|
||||||
|
this(version, sendChannel, repeatCount, delayBetweenPackets_ms, listenChannel, timeout_ms, retryCount, null,
|
||||||
|
packetToSend);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public SendAndListen(RileyLinkFirmwareVersion version, byte sendChannel, byte repeatCount,
|
||||||
|
int delayBetweenPackets_ms, byte listenChannel, int timeout_ms, byte retryCount,
|
||||||
|
Integer preambleExtension_ms, RadioPacket packetToSend
|
||||||
|
|
||||||
|
) {
|
||||||
|
super(version);
|
||||||
|
this.sendChannel = sendChannel;
|
||||||
|
this.repeatCount = repeatCount;
|
||||||
|
this.delayBetweenPackets_ms = delayBetweenPackets_ms;
|
||||||
|
this.listenChannel = listenChannel;
|
||||||
|
this.timeout_ms = timeout_ms;
|
||||||
|
this.retryCount = retryCount;
|
||||||
|
this.preambleExtension_ms = preambleExtension_ms == null ? 0 : preambleExtension_ms;
|
||||||
|
this.packetToSend = packetToSend;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RileyLinkCommandType getCommandType() {
|
||||||
|
return RileyLinkCommandType.SendAndListen;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] getRaw() {
|
||||||
|
|
||||||
|
boolean isPacketV2 = this.version.isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher);
|
||||||
|
|
||||||
|
ArrayList<Byte> bytes = new ArrayList<Byte>();
|
||||||
|
bytes.add(this.getCommandType().code);
|
||||||
|
bytes.add(this.sendChannel);
|
||||||
|
bytes.add(this.repeatCount);
|
||||||
|
|
||||||
|
if (isPacketV2) { // delay is unsigned 16-bit integer
|
||||||
|
byte[] delayBuff = ByteBuffer.allocate(4).putInt(delayBetweenPackets_ms).array();
|
||||||
|
bytes.add(delayBuff[2]);
|
||||||
|
bytes.add(delayBuff[3]);
|
||||||
|
} else {
|
||||||
|
bytes.add((byte)delayBetweenPackets_ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes.add(this.listenChannel);
|
||||||
|
|
||||||
|
byte[] timeoutBuff = ByteBuffer.allocate(4).putInt(timeout_ms).array();
|
||||||
|
|
||||||
|
bytes.add(timeoutBuff[0]);
|
||||||
|
bytes.add(timeoutBuff[1]);
|
||||||
|
bytes.add(timeoutBuff[2]);
|
||||||
|
bytes.add(timeoutBuff[3]);
|
||||||
|
|
||||||
|
bytes.add(retryCount);
|
||||||
|
|
||||||
|
if (isPacketV2) { // 2.x (and probably higher versions) support preamble extension
|
||||||
|
byte[] preambleBuf = ByteBuffer.allocate(4).putInt(preambleExtension_ms).array();
|
||||||
|
bytes.add(preambleBuf[2]);
|
||||||
|
bytes.add(preambleBuf[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ByteUtil.concat(ByteUtil.fromByteArray(bytes), packetToSend.getEncoded());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.NotImplementedException;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkCommandType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
|
|
||||||
|
public class SetPreamble extends RileyLinkCommand {
|
||||||
|
|
||||||
|
private int preamble;
|
||||||
|
|
||||||
|
|
||||||
|
public SetPreamble(RileyLinkFirmwareVersion version, int preamble) throws Exception {
|
||||||
|
super(version);
|
||||||
|
if (!this.version.isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher)) { // this command was not supported
|
||||||
|
// before 2.0
|
||||||
|
throw new NotImplementedException("Old firmware does not support SetPreamble command");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preamble < 0 || preamble > 0xFFFF) {
|
||||||
|
throw new Exception("preamble value is out of range");
|
||||||
|
}
|
||||||
|
this.preamble = preamble;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RileyLinkCommandType getCommandType() {
|
||||||
|
return RileyLinkCommandType.SetPreamble;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] getRaw() {
|
||||||
|
byte[] bytes = ByteBuffer.allocate(4).putInt(preamble).array();
|
||||||
|
return getByteArray(this.getCommandType().code, bytes[2], bytes[3]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkCommandType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkEncodingType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
|
|
||||||
|
public class SetSoftwareEncoding extends RileyLinkCommand {
|
||||||
|
|
||||||
|
private final RileyLinkEncodingType encoding;
|
||||||
|
|
||||||
|
|
||||||
|
public SetSoftwareEncoding(RileyLinkFirmwareVersion version, RileyLinkEncodingType encoding) {
|
||||||
|
super(version);
|
||||||
|
this.encoding = encoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RileyLinkCommandType getCommandType() {
|
||||||
|
return RileyLinkCommandType.SetSWEncoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] getRaw() {
|
||||||
|
return getByteArray(getCommandType().code, encoding.value);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.CC111XRegister;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkCommandType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
|
|
||||||
|
public class UpdateRegister extends RileyLinkCommand {
|
||||||
|
|
||||||
|
CC111XRegister register;
|
||||||
|
byte registerValue;
|
||||||
|
|
||||||
|
|
||||||
|
public UpdateRegister(RileyLinkFirmwareVersion version, CC111XRegister register, byte registerValue) {
|
||||||
|
super(version);
|
||||||
|
this.register = register;
|
||||||
|
this.registerValue = registerValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RileyLinkCommandType getCommandType() {
|
||||||
|
return RileyLinkCommandType.UpdateRegister;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] getRaw() {
|
||||||
|
return getByteArray(getCommandType().code, register.value, registerValue);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data;
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RFSpyCommand;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command.RileyLinkCommand;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RFSpyRLResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 5/26/16.
|
* Created by geoff on 5/26/16.
|
||||||
|
@ -10,9 +11,13 @@ public class RFSpyResponse {
|
||||||
// 0xaa == timeout
|
// 0xaa == timeout
|
||||||
// 0xbb == interrupted
|
// 0xbb == interrupted
|
||||||
// 0xcc == zero-data
|
// 0xcc == zero-data
|
||||||
|
// 0xdd == success
|
||||||
|
// 0x11 == invalidParam
|
||||||
|
// 0x22 == unknownCommand
|
||||||
|
|
||||||
protected byte[] raw;
|
protected byte[] raw;
|
||||||
protected RadioResponse radioResponse;
|
protected RadioResponse radioResponse;
|
||||||
private RFSpyCommand command;
|
private RileyLinkCommand command;
|
||||||
|
|
||||||
|
|
||||||
public RFSpyResponse() {
|
public RFSpyResponse() {
|
||||||
|
@ -25,7 +30,7 @@ public class RFSpyResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public RFSpyResponse(RFSpyCommand command, byte[] rawResponse) {
|
public RFSpyResponse(RileyLinkCommand command, byte[] rawResponse) {
|
||||||
|
|
||||||
this.command = command;
|
this.command = command;
|
||||||
init(rawResponse);
|
init(rawResponse);
|
||||||
|
@ -39,15 +44,15 @@ public class RFSpyResponse {
|
||||||
raw = bytes;
|
raw = bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public RadioResponse getRadioResponse() {
|
||||||
if (looksLikeRadioPacket()) {
|
if (looksLikeRadioPacket()) {
|
||||||
radioResponse = new RadioResponse(command, raw);
|
radioResponse = new RadioResponse(command, raw);
|
||||||
} else {
|
} else {
|
||||||
radioResponse = new RadioResponse();
|
radioResponse = new RadioResponse();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public RadioResponse getRadioResponse() {
|
|
||||||
return radioResponse;
|
return radioResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,9 +77,29 @@ public class RFSpyResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isInvalidParam() {
|
||||||
|
if ((raw.length == 1) || (raw.length == 2)) {
|
||||||
|
if (raw[0] == (byte)0x11) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isUnknownCommand() {
|
||||||
|
if ((raw.length == 1) || (raw.length == 2)) {
|
||||||
|
if (raw[0] == (byte)0x22) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isOK() {
|
public boolean isOK() {
|
||||||
if ((raw.length == 1) || (raw.length == 2)) {
|
if ((raw.length == 1) || (raw.length == 2)) {
|
||||||
if (raw[0] == (byte)0x01) {
|
if (raw[0] == (byte)0x01 || raw[0] == (byte)0xDD) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,6 +115,17 @@ public class RFSpyResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
if (raw.length > 2) {
|
||||||
|
return "Radio packet";
|
||||||
|
} else {
|
||||||
|
RFSpyRLResponse r = RFSpyRLResponse.fromByte(raw[0]);
|
||||||
|
return r.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public byte[] getRaw() {
|
public byte[] getRaw() {
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data;
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.NotImplementedException;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RFTools;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RFTools;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.CRC;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.CRC;
|
||||||
|
@ -30,10 +33,22 @@ public class RadioPacket {
|
||||||
|
|
||||||
|
|
||||||
public byte[] getEncoded() {
|
public byte[] getEncoded() {
|
||||||
byte[] withCRC = ByteUtil.concat(pkt, CRC.crc8(pkt));
|
|
||||||
|
switch (RileyLinkUtil.getEncoding()) {
|
||||||
|
case Manchester: { // We have this encoding in RL firmware
|
||||||
|
return pkt;
|
||||||
|
}
|
||||||
|
|
||||||
|
case FourByteSixByte: {
|
||||||
|
byte[] withCRC = getWithCRC();
|
||||||
|
|
||||||
byte[] encoded = RFTools.encode4b6b(withCRC);
|
byte[] encoded = RFTools.encode4b6b(withCRC);
|
||||||
byte[] withNullTerm = ByteUtil.concat(encoded, (byte)0);
|
return ByteUtil.concat(encoded, (byte)0);
|
||||||
return withNullTerm;
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new NotImplementedException(("Encoding not supported: " + RileyLinkUtil.getEncoding().toString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data;
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.data;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.NotImplementedException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RFTools;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RFTools;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RFSpyCommand;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.command.RileyLinkCommand;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkCommandType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.CRC;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.CRC;
|
||||||
|
|
||||||
|
@ -20,10 +24,11 @@ public class RadioResponse {
|
||||||
public int responseNumber;
|
public int responseNumber;
|
||||||
public byte[] decodedPayload = new byte[0];
|
public byte[] decodedPayload = new byte[0];
|
||||||
public byte receivedCRC;
|
public byte receivedCRC;
|
||||||
private RFSpyCommand command;
|
private RileyLinkCommand command;
|
||||||
|
|
||||||
|
|
||||||
public RadioResponse() {
|
public RadioResponse() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,8 +37,7 @@ public class RadioResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public RadioResponse(RFSpyCommand command, byte[] raw) {
|
public RadioResponse(RileyLinkCommand command, byte[] raw) {
|
||||||
|
|
||||||
this.command = command;
|
this.command = command;
|
||||||
init(raw);
|
init(raw);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +45,8 @@ public class RadioResponse {
|
||||||
|
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
|
|
||||||
if (command != null && !command.isEncoded()) {
|
// We should check for all listening commands, but only one is actually used
|
||||||
|
if (command != null && command.getCommandType() != RileyLinkCommandType.SendAndListen) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +63,7 @@ public class RadioResponse {
|
||||||
|
|
||||||
|
|
||||||
public void init(byte[] rxData) {
|
public void init(byte[] rxData) {
|
||||||
|
|
||||||
if (rxData == null) {
|
if (rxData == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -67,27 +73,47 @@ public class RadioResponse {
|
||||||
}
|
}
|
||||||
rssi = rxData[0];
|
rssi = rxData[0];
|
||||||
responseNumber = rxData[1];
|
responseNumber = rxData[1];
|
||||||
byte[] encodedPayload = ByteUtil.substring(rxData, 2, rxData.length - 2);
|
byte[] encodedPayload;
|
||||||
|
|
||||||
|
if (RileyLinkFirmwareVersion.isSameVersion(RileyLinkUtil.getRileyLinkServiceData().versionCC110,
|
||||||
|
RileyLinkFirmwareVersion.Version2)) {
|
||||||
|
encodedPayload = ByteUtil.substring(rxData, 3, rxData.length - 3);
|
||||||
|
} else {
|
||||||
|
encodedPayload = ByteUtil.substring(rxData, 2, rxData.length - 2);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
boolean isEncoded = command == null || command.isEncoded();
|
// for non-radio commands we just return the raw response
|
||||||
|
// well, for non-radio commands we shouldn't even reach this point
|
||||||
|
// but getVersion is kind of exception
|
||||||
|
if (command != null && //
|
||||||
|
command.getCommandType() != RileyLinkCommandType.SendAndListen) {
|
||||||
|
decodedOK = true;
|
||||||
|
decodedPayload = encodedPayload;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isEncoded) {
|
switch (RileyLinkUtil.getEncoding()) {
|
||||||
|
case Manchester:
|
||||||
|
decodedOK = true;
|
||||||
|
decodedPayload = encodedPayload;
|
||||||
|
break;
|
||||||
|
case FourByteSixByte:
|
||||||
byte[] decodeThis = RFTools.decode4b6b(encodedPayload);
|
byte[] decodeThis = RFTools.decode4b6b(encodedPayload);
|
||||||
decodedOK = true;
|
decodedOK = true;
|
||||||
decodedPayload = ByteUtil.substring(decodeThis, 0, decodeThis.length - 1);
|
decodedPayload = ByteUtil.substring(decodeThis, 0, decodeThis.length - 1);
|
||||||
byte calculatedCRC = CRC.crc8(decodedPayload);
|
|
||||||
receivedCRC = decodeThis[decodeThis.length - 1];
|
receivedCRC = decodeThis[decodeThis.length - 1];
|
||||||
|
byte calculatedCRC = CRC.crc8(decodedPayload);
|
||||||
if (receivedCRC != calculatedCRC) {
|
if (receivedCRC != calculatedCRC) {
|
||||||
LOG.error(String.format("RadioResponse: CRC mismatch, calculated 0x%02x, received 0x%02x",
|
LOG.error(String.format("RadioResponse: CRC mismatch, calculated 0x%02x, received 0x%02x",
|
||||||
calculatedCRC, receivedCRC));
|
calculatedCRC, receivedCRC));
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
decodedOK = true;
|
default:
|
||||||
decodedPayload = encodedPayload;
|
throw new NotImplementedException("this {" + RileyLinkUtil.getEncoding().toString()
|
||||||
|
+ "} encoding is not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
// byte[] decodeThis = RFTools.decode4b6b(encodedPayload);
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
decodedOK = false;
|
decodedOK = false;
|
||||||
LOG.error("Failed to decode radio data: " + ByteUtil.shortHexString(encodedPayload));
|
LOG.error("Failed to decode radio data: " + ByteUtil.shortHexString(encodedPayload));
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs;
|
||||||
|
|
||||||
|
public enum RFSpyRLResponse {
|
||||||
|
// 0xaa == timeout
|
||||||
|
// 0xbb == interrupted
|
||||||
|
// 0xcc == zero-data
|
||||||
|
// 0xdd == success
|
||||||
|
// 0x11 == invalidParam
|
||||||
|
// 0x22 == unknownCommand
|
||||||
|
|
||||||
|
Invalid(0), // default, just fail
|
||||||
|
Timeout(0xAA),
|
||||||
|
Interrupted(0xBB),
|
||||||
|
ZeroData(0xCC),
|
||||||
|
Success(0xDD),
|
||||||
|
OldSuccess(0x01),
|
||||||
|
InvalidParam(0x11),
|
||||||
|
UnknownCommand(0x22), ;
|
||||||
|
|
||||||
|
byte value;
|
||||||
|
|
||||||
|
|
||||||
|
RFSpyRLResponse(int value) {
|
||||||
|
this.value = (byte)value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static RFSpyRLResponse fromByte(byte input) {
|
||||||
|
for (RFSpyRLResponse type : values()) {
|
||||||
|
if (type.value == input) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by andy on 22/05/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum RileyLinkCommandType {
|
||||||
|
|
||||||
|
GetState(1), //
|
||||||
|
GetVersion(2), //
|
||||||
|
GetPacket(3), // aka Listen, receive
|
||||||
|
Send(4), //
|
||||||
|
SendAndListen(5), //
|
||||||
|
UpdateRegister(6), //
|
||||||
|
Reset(7), //
|
||||||
|
Led(8),
|
||||||
|
ReadRegister(8),
|
||||||
|
SetModeRegisters(10),
|
||||||
|
SetSWEncoding(11),
|
||||||
|
SetPreamble(12),
|
||||||
|
ResetRadioConfig(13),
|
||||||
|
GetStatistics(14), ;
|
||||||
|
|
||||||
|
public byte code;
|
||||||
|
|
||||||
|
|
||||||
|
RileyLinkCommandType(int code) {
|
||||||
|
this.code = (byte)code;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs;
|
||||||
|
|
||||||
|
public enum RileyLinkEncodingType {
|
||||||
|
None(0x00), //
|
||||||
|
Manchester(0x01), //
|
||||||
|
FourByteSixByte(0x02), //
|
||||||
|
;
|
||||||
|
|
||||||
|
public byte value;
|
||||||
|
|
||||||
|
|
||||||
|
RileyLinkEncodingType(int value) {
|
||||||
|
this.value = (byte)value;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public enum RileyLinkFirmwareVersion {
|
||||||
|
|
||||||
|
Version_0_0(0, 0, "0.0"), // just for defaulting
|
||||||
|
Version_0_9(0, 9, "0.9"), //
|
||||||
|
Version_1_0(1, 0, "1.0"), //
|
||||||
|
Version_2_0(2, 0, "2.0"), //
|
||||||
|
Version_2_2(2, 2, "2.2"), //
|
||||||
|
Version_3_0(3, 0, "3.0"), //
|
||||||
|
UnknownVersion(0, 0, "???"), //
|
||||||
|
Version1(Version_0_0, Version_0_9, Version_1_0), //
|
||||||
|
Version2(Version_2_0, Version_2_2), //
|
||||||
|
Version2AndHigher(Version_2_0, Version_2_2, Version_3_0), //
|
||||||
|
;
|
||||||
|
|
||||||
|
private static final String FIRMWARE_IDENTIFICATION_PREFIX = "subg_rfspy ";
|
||||||
|
private static final Pattern _version_pattern = Pattern.compile(FIRMWARE_IDENTIFICATION_PREFIX
|
||||||
|
+ "([0-9]+)\\.([0-9]+)");
|
||||||
|
static Map<String, RileyLinkFirmwareVersion> mapByVersion;
|
||||||
|
|
||||||
|
static {
|
||||||
|
mapByVersion = new HashMap<>();
|
||||||
|
for (RileyLinkFirmwareVersion version : values()) {
|
||||||
|
if (version.familyMembers == null) {
|
||||||
|
mapByVersion.put(version.versionKey, version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected RileyLinkFirmwareVersion[] familyMembers;
|
||||||
|
private int major;
|
||||||
|
private int minor;
|
||||||
|
private String versionKey = "";
|
||||||
|
|
||||||
|
|
||||||
|
RileyLinkFirmwareVersion(int major, int minor, String versionKey) {
|
||||||
|
this.major = major;
|
||||||
|
this.minor = minor;
|
||||||
|
this.versionKey = versionKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RileyLinkFirmwareVersion(RileyLinkFirmwareVersion... familyMembers) {
|
||||||
|
this.familyMembers = familyMembers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean isSameVersion(RileyLinkFirmwareVersion versionWeCheck, RileyLinkFirmwareVersion versionSources) {
|
||||||
|
if (versionSources.familyMembers != null) {
|
||||||
|
for (RileyLinkFirmwareVersion vrs : versionSources.familyMembers) {
|
||||||
|
if (vrs == versionWeCheck)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return (versionWeCheck == versionSources);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static RileyLinkFirmwareVersion getByVersionString(String versionString) {
|
||||||
|
if (versionString != null) {
|
||||||
|
Matcher m = _version_pattern.matcher(versionString);
|
||||||
|
if (m.find()) {
|
||||||
|
int major = Integer.parseInt(m.group(1));
|
||||||
|
int minor = Integer.parseInt(m.group(2));
|
||||||
|
String versionKey = major + "." + minor;
|
||||||
|
if (mapByVersion.containsKey(versionKey)) {
|
||||||
|
return mapByVersion.get(versionKey);
|
||||||
|
} else {
|
||||||
|
return defaultToLowestMajorVersion(major); // just in case there is new release that we don't cover
|
||||||
|
// example: 2.3 etc
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return RileyLinkFirmwareVersion.UnknownVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static RileyLinkFirmwareVersion defaultToLowestMajorVersion(int major) {
|
||||||
|
if (mapByVersion.containsKey(major + ".0")) {
|
||||||
|
return mapByVersion.get(major + ".0");
|
||||||
|
}
|
||||||
|
return UnknownVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isSameVersion(RileyLinkFirmwareVersion versionSources) {
|
||||||
|
return isSameVersion(this, versionSources);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return FIRMWARE_IDENTIFICATION_PREFIX + versionKey;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by andy on 5/19/18.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum RileyLinkTargetDevice {
|
||||||
|
MedtronicPump, //
|
||||||
|
Omnipod, //
|
||||||
|
;
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by andy on 9/10/18.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BleAdvertisedData {
|
||||||
|
|
||||||
|
private List<UUID> mUuids;
|
||||||
|
private String mName;
|
||||||
|
|
||||||
|
|
||||||
|
public BleAdvertisedData(List<UUID> uuids, String name) {
|
||||||
|
mUuids = uuids;
|
||||||
|
mName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<UUID> getUuids() {
|
||||||
|
return mUuids;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return mName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "BleAdvertisedData [name=" + mName + ", UUIDs=" + mUuids + "]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,8 @@ import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkConst
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RFSpy;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RFSpy;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RileyLinkBLE;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RileyLinkBLE;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkEncodingType;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkError;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkError;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkServiceState;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkServiceState;
|
||||||
|
@ -61,10 +63,14 @@ public abstract class RileyLinkService extends Service {
|
||||||
determineRileyLinkTargetFrequency();
|
determineRileyLinkTargetFrequency();
|
||||||
RileyLinkUtil.setRileyLinkService(this);
|
RileyLinkUtil.setRileyLinkService(this);
|
||||||
RileyLinkUtil.setRileyLinkTargetFrequency(rileyLinkTargetFrequency);
|
RileyLinkUtil.setRileyLinkTargetFrequency(rileyLinkTargetFrequency);
|
||||||
|
RileyLinkUtil.setEncoding(getEncoding());
|
||||||
initRileyLinkServiceData();
|
initRileyLinkServiceData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public abstract RileyLinkEncodingType getEncoding();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You need to determine which frequencies RileyLink will use, and set rileyLinkTargetFrequency
|
* You need to determine which frequencies RileyLink will use, and set rileyLinkTargetFrequency
|
||||||
*/
|
*/
|
||||||
|
@ -148,13 +154,15 @@ public abstract class RileyLinkService extends Service {
|
||||||
rileyLinkBLE.enableNotifications();
|
rileyLinkBLE.enableNotifications();
|
||||||
rfspy.startReader(); // call startReader from outside?
|
rfspy.startReader(); // call startReader from outside?
|
||||||
|
|
||||||
String data = rfspy.getVersion();
|
rfspy.initializeRileyLink();
|
||||||
LOG.debug("RfSpy version (BLE113): " + data);
|
String bleVersion = rfspy.getBLEVersionCached();
|
||||||
rileyLinkServiceData.versionBLE113 = data;
|
RileyLinkFirmwareVersion rlVersion = rfspy.getRLVersionCached();
|
||||||
|
|
||||||
data = rfspy.getRadioVersion();
|
LOG.debug("RfSpy version (BLE113): " + bleVersion);
|
||||||
LOG.debug("RfSpy Radio version (CC110): " + data);
|
rileyLinkServiceData.versionBLE113 = bleVersion;
|
||||||
rileyLinkServiceData.versionCC110 = data;
|
|
||||||
|
LOG.debug("RfSpy Radio version (CC110): " + rlVersion.name());
|
||||||
|
rileyLinkServiceData.versionCC110 = rlVersion;
|
||||||
|
|
||||||
ServiceTask task = new InitializePumpManagerTask();
|
ServiceTask task = new InitializePumpManagerTask();
|
||||||
ServiceTaskExecutor.startTask(task);
|
ServiceTaskExecutor.startTask(task);
|
||||||
|
@ -187,6 +195,8 @@ public abstract class RileyLinkService extends Service {
|
||||||
reconfigureRileyLink(RileylinkBLEAddress);
|
reconfigureRileyLink(RileylinkBLEAddress);
|
||||||
// MainApp.getServiceClientConnection().setThisRileylink(RileylinkBLEAddress);
|
// MainApp.getServiceClientConnection().setThisRileylink(RileylinkBLEAddress);
|
||||||
}
|
}
|
||||||
|
} else if (action.equals(RileyLinkConst.Intents.RileyLinkDisconnect)) {
|
||||||
|
disconnectRileyLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -248,6 +258,7 @@ public abstract class RileyLinkService extends Service {
|
||||||
intentFilter.addAction(RileyLinkConst.Intents.RileyLinkDisconnected);
|
intentFilter.addAction(RileyLinkConst.Intents.RileyLinkDisconnected);
|
||||||
intentFilter.addAction(RileyLinkConst.Intents.BluetoothReconnected);
|
intentFilter.addAction(RileyLinkConst.Intents.BluetoothReconnected);
|
||||||
intentFilter.addAction(RileyLinkConst.Intents.RileyLinkNewAddressSet);
|
intentFilter.addAction(RileyLinkConst.Intents.RileyLinkNewAddressSet);
|
||||||
|
intentFilter.addAction(RileyLinkConst.Intents.RileyLinkDisconnect);
|
||||||
// intentFilter.addAction(RT2Const.serviceLocal.ipcBound);
|
// intentFilter.addAction(RT2Const.serviceLocal.ipcBound);
|
||||||
// intentFilter.addAction(RT2Const.IPC.MSG_BLE_accessGranted);
|
// intentFilter.addAction(RT2Const.IPC.MSG_BLE_accessGranted);
|
||||||
// intentFilter.addAction(RT2Const.IPC.MSG_BLE_accessDenied);
|
// intentFilter.addAction(RT2Const.IPC.MSG_BLE_accessDenied);
|
||||||
|
@ -460,7 +471,11 @@ public abstract class RileyLinkService extends Service {
|
||||||
|
|
||||||
|
|
||||||
public void disconnectRileyLink() {
|
public void disconnectRileyLink() {
|
||||||
|
|
||||||
|
if (this.rileyLinkBLE.isConnected()) {
|
||||||
this.rileyLinkBLE.disconnect();
|
this.rileyLinkBLE.disconnect();
|
||||||
|
rileyLinkServiceData.rileylinkAddress = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.service;
|
package info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.service;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkError;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkError;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkServiceState;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkServiceState;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkTargetDevice;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkTargetDevice;
|
||||||
|
@ -20,7 +21,7 @@ public class RileyLinkServiceData {
|
||||||
// bt version
|
// bt version
|
||||||
public String versionBLE113;
|
public String versionBLE113;
|
||||||
// radio version
|
// radio version
|
||||||
public String versionCC110;
|
public RileyLinkFirmwareVersion versionCC110;
|
||||||
|
|
||||||
public RileyLinkTargetDevice targetDevice;
|
public RileyLinkTargetDevice targetDevice;
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ public class InitializePumpManagerTask extends ServiceTask {
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
double lastGoodFrequency = SP.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0d);
|
double lastGoodFrequency = SP.getDouble(RileyLinkConst.Prefs.LastGoodDeviceFrequency, 0.0d);
|
||||||
|
lastGoodFrequency = Math.round(lastGoodFrequency * 1000d) / 1000d;
|
||||||
|
|
||||||
RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency = lastGoodFrequency;
|
RileyLinkUtil.getRileyLinkServiceData().lastGoodFrequency = lastGoodFrequency;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,9 @@ import info.nightscout.androidaps.plugins.PumpMedtronic.service.RileyLinkMedtron
|
||||||
*/
|
*/
|
||||||
public class WakeAndTuneTask extends PumpTask {
|
public class WakeAndTuneTask extends PumpTask {
|
||||||
|
|
||||||
|
private static final String TAG = "WakeAndTuneTask";
|
||||||
|
|
||||||
|
|
||||||
public WakeAndTuneTask() {
|
public WakeAndTuneTask() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,27 @@ public class CRC {
|
||||||
203, 80, 190, 37, 19, 136, 127, 228, 210, 73, 149, 14, 56, 163, 84, 207, 249, 98, 140, 23, 33, 186, 77, 214,
|
203, 80, 190, 37, 19, 136, 127, 228, 210, 73, 149, 14, 56, 163, 84, 207, 249, 98, 140, 23, 33, 186, 77, 214,
|
||||||
224, 123 };
|
224, 123 };
|
||||||
|
|
||||||
|
static final int[] crc16lookup = new int[] {
|
||||||
|
0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d,
|
||||||
|
0x8027, 0x0022, 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, 0x0050, 0x8055, 0x805f, 0x005a,
|
||||||
|
0x804b, 0x004e, 0x0044, 0x8041, 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, 0x00f0, 0x80f5,
|
||||||
|
0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
|
||||||
|
0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d,
|
||||||
|
0x8197, 0x0192, 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, 0x01e0, 0x81e5, 0x81ef, 0x01ea,
|
||||||
|
0x81fb, 0x01fe, 0x01f4, 0x81f1, 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, 0x0140, 0x8145,
|
||||||
|
0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
|
||||||
|
0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e,
|
||||||
|
0x0104, 0x8101, 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, 0x0330, 0x8335, 0x833f, 0x033a,
|
||||||
|
0x832b, 0x032e, 0x0324, 0x8321, 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, 0x8353, 0x0356,
|
||||||
|
0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
|
||||||
|
0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd,
|
||||||
|
0x83b7, 0x03b2, 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, 0x0280, 0x8285, 0x828f, 0x028a,
|
||||||
|
0x829b, 0x029e, 0x0294, 0x8291, 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, 0x82e3, 0x02e6,
|
||||||
|
0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
|
||||||
|
0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e,
|
||||||
|
0x0264, 0x8261, 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, 0x8213, 0x0216, 0x021c, 0x8219,
|
||||||
|
0x0208, 0x820d, 0x8207, 0x0202 };
|
||||||
|
|
||||||
|
|
||||||
public static byte crc8(byte[] data, int len) {
|
public static byte crc8(byte[] data, int len) {
|
||||||
byte result = 0;
|
byte result = 0;
|
||||||
|
@ -120,4 +141,13 @@ public class CRC {
|
||||||
crc &= 0xffff;
|
crc &= 0xffff;
|
||||||
return new byte[] { (byte)((crc & 0xFF00) >> 8), (byte)(crc & 0xFF) };
|
return new byte[] { (byte)((crc & 0xFF00) >> 8), (byte)(crc & 0xFF) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static int crc16(byte[] bytes) {
|
||||||
|
int crc = 0x0000;
|
||||||
|
for (byte b : bytes) {
|
||||||
|
crc = (crc >>> 8) ^ crc16lookup[(crc ^ b) & 0xff];
|
||||||
|
}
|
||||||
|
return crc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.Riley
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.HexDump;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.HexDump;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.Page;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.Page;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.Record;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.Record;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.history.RawHistoryPage;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.history.RawHistoryPage;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.message.ButtonPressCarelinkMessageBody;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.message.ButtonPressCarelinkMessageBody;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.message.CarelinkLongMessageBody;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.message.CarelinkLongMessageBody;
|
||||||
|
@ -689,6 +689,10 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (responseRaw.length == 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return !(responseRaw[last] == 0x00 && responseRaw[last - 1] == 0x00 && responseRaw[last - 2] == 0x00);
|
return !(responseRaw[last] == 0x00 && responseRaw[last - 1] == 0x00 && responseRaw[last - 2] == 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,11 @@ import android.util.Log;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.CRC;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.CRC;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.HexDump;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.HexDump;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.PumpTimeStamp;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.PumpTimeStamp;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.Record;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.Record;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.RecordTypeEnum;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.RecordTypeEnum;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeFormat;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeFormat;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.IgnoredHistoryEntry;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.IgnoredHistoryEntry;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old;
|
||||||
|
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.joda.time.LocalDateTime;
|
import org.joda.time.LocalDateTime;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
@ -6,60 +6,60 @@ import java.util.Map;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.AlarmClockReminderPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.AlarmClockReminderPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.AlarmSensorPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.AlarmSensorPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.BGReceivedPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.BGReceivedPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.BasalProfileStart;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.BasalProfileStart;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.BatteryPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.BatteryPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.BolusNormalPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.BolusNormalPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.BolusWizardBolusEstimatePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.BolusWizardBolusEstimatePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.CalBgForPhPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.CalBgForPhPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeAlarmClockEnablePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeAlarmClockEnablePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeAlarmNotifyModePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeAlarmNotifyModePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeAudioBolusPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeAudioBolusPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeBGReminderEnablePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeBGReminderEnablePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeBasalProfilePatternPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeBasalProfilePatternPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeBasalProfilePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeBasalProfilePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeBolusReminderEnablePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeBolusReminderEnablePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeBolusReminderTimePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeBolusReminderTimePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeBolusScrollStepSizePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeBolusScrollStepSizePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeBolusWizardSetupPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeBolusWizardSetupPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeCaptureEventEnablePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeCaptureEventEnablePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeCarbUnitsPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeCarbUnitsPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeChildBlockEnablePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeChildBlockEnablePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeMaxBolusPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeMaxBolusPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeOtherDeviceIDPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeOtherDeviceIDPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeReservoirWarningTimePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeReservoirWarningTimePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeSensorRateOfChangeAlertSetupPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeSensorRateOfChangeAlertSetupPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeSensorSetup2PumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeSensorSetup2PumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeTempBasalTypePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeTempBasalTypePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeTimeFormatPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeTimeFormatPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeTimePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeTimePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeVariableBolusPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeVariableBolusPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeWatchdogEnablePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeWatchdogEnablePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ChangeWatchdogMarriageProfilePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ChangeWatchdogMarriageProfilePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ClearAlarmPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ClearAlarmPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.DeleteAlarmClockTimePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.DeleteAlarmClockTimePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.DeleteBolusReminderTimePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.DeleteBolusReminderTimePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.DeleteOtherDeviceIDPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.DeleteOtherDeviceIDPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.EnableDisableRemotePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.EnableDisableRemotePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.IgnoredHistoryEntry;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.IgnoredHistoryEntry;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.InsulinMarkerEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.InsulinMarkerEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.JournalEntryExerciseMarkerPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.JournalEntryExerciseMarkerPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.JournalEntryPumpLowBatteryPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.JournalEntryPumpLowBatteryPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.JournalEntryPumpLowReservoirPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.JournalEntryPumpLowReservoirPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.Model522ResultTotalsPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.Model522ResultTotalsPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.NewTimeSet;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.NewTimeSet;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.PrimePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.PrimePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.PumpAlarmPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.PumpAlarmPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ResultDailyTotalPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ResultDailyTotalPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.ResumePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.ResumePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.RewindPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.RewindPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.SuspendPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.SuspendPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.TempBasalDurationPumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.TempBasalDurationPumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.TempBasalRatePumpEvent;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.TempBasalRatePumpEvent;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.UnabsorbedInsulin;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.UnabsorbedInsulin;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record.Unknown7ByteEvent1;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record.Unknown7ByteEvent1;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old;
|
||||||
|
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.joda.time.LocalDateTime;
|
import org.joda.time.LocalDateTime;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/11/16.
|
* Created by geoff on 6/11/16.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class AlarmClockReminderPumpEvent extends TimeStampedRecord {
|
public class AlarmClockReminderPumpEvent extends TimeStampedRecord {
|
||||||
|
|
||||||
public AlarmClockReminderPumpEvent() {
|
public AlarmClockReminderPumpEvent() {
|
|
@ -1,10 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class AlarmSensorPumpEvent extends TimeStampedRecord {
|
public class AlarmSensorPumpEvent extends TimeStampedRecord {
|
||||||
|
|
||||||
public AlarmSensorPumpEvent() {
|
public AlarmSensorPumpEvent() {
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
public class BGReceivedPumpEvent extends TimeStampedRecord {
|
public class BGReceivedPumpEvent extends TimeStampedRecord {
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
public class BasalProfileStart extends TimeStampedRecord {
|
public class BasalProfileStart extends TimeStampedRecord {
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class BatteryPumpEvent extends TimeStampedRecord {
|
public class BatteryPumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.PumpTimeStamp;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.PumpTimeStamp;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeFormat;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeFormat;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
public class BolusNormalPumpEvent extends TimeStampedRecord {
|
public class BolusNormalPumpEvent extends TimeStampedRecord {
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
public class BolusWizardBolusEstimatePumpEvent extends TimeStampedRecord {
|
public class BolusWizardBolusEstimatePumpEvent extends TimeStampedRecord {
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
public class CalBgForPhPumpEvent extends TimeStampedRecord {
|
public class CalBgForPhPumpEvent extends TimeStampedRecord {
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class ChangeAlarmNotifyModePumpEvent extends TimeStampedRecord {
|
public class ChangeAlarmNotifyModePumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class ChangeBasalProfilePumpEvent extends TimeStampedRecord {
|
public class ChangeBasalProfilePumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class ChangeBolusWizardSetupPumpEvent extends TimeStampedRecord {
|
public class ChangeBolusWizardSetupPumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class ChangeOtherDeviceIDPumpEvent extends TimeStampedRecord {
|
public class ChangeOtherDeviceIDPumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class ChangeTimeFormatPumpEvent extends TimeStampedRecord {
|
public class ChangeTimeFormatPumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class ChangeTimePumpEvent extends TimeStampedRecord {
|
public class ChangeTimePumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,7 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class ClearAlarmPumpEvent extends TimeStampedRecord {
|
public class ClearAlarmPumpEvent extends TimeStampedRecord {
|
||||||
|
|
||||||
public ClearAlarmPumpEvent() {
|
public ClearAlarmPumpEvent() {
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class EnableDisableRemotePumpEvent extends TimeStampedRecord {
|
public class EnableDisableRemotePumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.Record;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.Record;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.RecordTypeEnum;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.RecordTypeEnum;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 7/16/16.
|
* Created by geoff on 7/16/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 6/5/16.
|
* Created by geoff on 6/5/16.
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class JournalEntryPumpLowBatteryPumpEvent extends TimeStampedRecord {
|
public class JournalEntryPumpLowBatteryPumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class JournalEntryPumpLowReservoirPumpEvent extends TimeStampedRecord {
|
public class JournalEntryPumpLowReservoirPumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class Model522ResultTotalsPumpEvent extends TimeStampedRecord {
|
public class Model522ResultTotalsPumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
// This event existed as 0x18 in Roundtrip and early Decocare,
|
// This event existed as 0x18 in Roundtrip and early Decocare,
|
|
@ -1,10 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class PrimePumpEvent extends TimeStampedRecord {
|
public class PrimePumpEvent extends TimeStampedRecord {
|
||||||
|
|
||||||
private double amount = 0.0;
|
private double amount = 0.0;
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
public class PumpAlarmPumpEvent extends TimeStampedRecord {
|
public class PumpAlarmPumpEvent extends TimeStampedRecord {
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.PumpTimeStamp;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.PumpTimeStamp;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeFormat;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeFormat;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class ResultDailyTotalPumpEvent extends TimeStampedRecord {
|
public class ResultDailyTotalPumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class ResumePumpEvent extends TimeStampedRecord {
|
public class ResumePumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class RewindPumpEvent extends TimeStampedRecord {
|
public class RewindPumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.PumpTimeStamp;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.PumpTimeStamp;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeFormat;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeFormat;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
public class Sara6EPumpEvent extends TimeStampedRecord {
|
public class Sara6EPumpEvent extends TimeStampedRecord {
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
public class SuspendPumpEvent extends TimeStampedRecord {
|
public class SuspendPumpEvent extends TimeStampedRecord {
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class TempBasalDurationPumpEvent extends TimeStampedRecord {
|
public class TempBasalDurationPumpEvent extends TimeStampedRecord {
|
||||||
|
|
||||||
private int durationMinutes = 0;
|
private int durationMinutes = 0;
|
|
@ -1,10 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class TempBasalRatePumpEvent extends TimeStampedRecord {
|
public class TempBasalRatePumpEvent extends TimeStampedRecord {
|
||||||
|
|
||||||
private double basalRate = 0.0; // rate in Units/hr
|
private double basalRate = 0.0; // rate in Units/hr
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@ -6,9 +6,10 @@ import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.utils.ByteUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.Record;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.Record;
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.defs.MedtronicDeviceType;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class UnabsorbedInsulin extends Record {
|
public class UnabsorbedInsulin extends Record {
|
||||||
|
|
||||||
private static final String TAG = "UnabsorbedInsulin";
|
private static final String TAG = "UnabsorbedInsulin";
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.record;
|
package info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.record;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history.TimeStampedRecord;
|
import info.nightscout.androidaps.plugins.PumpMedtronic.comm.data.history_old.TimeStampedRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by geoff on 7/16/16.
|
* Created by geoff on 7/16/16.
|
|
@ -8,7 +8,7 @@ import info.nightscout.androidaps.plugins.PumpCommon.utils.HexDump;
|
||||||
|
|
||||||
// Andy (4.6.2018): We probably need rewrite of this message body code. If there is no data sent, body is 00, which
|
// Andy (4.6.2018): We probably need rewrite of this message body code. If there is no data sent, body is 00, which
|
||||||
// denotes,
|
// denotes,
|
||||||
// no parameters. If we have 3 parameters sent (1 2 3), the body would actually be length of 4, first byte beeing the
|
// no parameters. If we have 3 parameters sent (1 2 3), the body would actually be length of 4, first byte being the
|
||||||
// length
|
// length
|
||||||
// of the message, so the body would be 3 1 2 3. This is not done that way now.
|
// of the message, so the body would be 3 1 2 3. This is not done that way now.
|
||||||
public class MessageBody {
|
public class MessageBody {
|
||||||
|
|
|
@ -63,6 +63,11 @@ public class BasalProfile {
|
||||||
LOG.error("setRawData: buffer is null!");
|
LOG.error("setRawData: buffer is null!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.length == 1) {
|
||||||
|
data = MedtronicUtil.createByteArray(data[0], (byte)0, (byte)0);
|
||||||
|
}
|
||||||
|
|
||||||
// int len = Math.min(MAX_RAW_DATA_SIZE, data.length);
|
// int len = Math.min(MAX_RAW_DATA_SIZE, data.length);
|
||||||
mRawData = data;
|
mRawData = data;
|
||||||
// System.arraycopy(data, 0, mRawData, 0, len);
|
// System.arraycopy(data, 0, mRawData, 0, len);
|
||||||
|
|
|
@ -109,8 +109,7 @@ public enum MedtronicCommandType implements Serializable // , MinimedCommandType
|
||||||
GetHistoryData(128, "History data", MinimedTargetType.PumpData, MedtronicDeviceType.Medtronic_512andHigher, MinimedCommandParameterType.SubCommands, 1024, 36, 0), // 0x80
|
GetHistoryData(128, "History data", MinimedTargetType.PumpData, MedtronicDeviceType.Medtronic_512andHigher, MinimedCommandParameterType.SubCommands, 1024, 36, 0), // 0x80
|
||||||
// new MinimedCommandHistoryData(36)
|
// new MinimedCommandHistoryData(36)
|
||||||
|
|
||||||
GetBasalProfileSTD(146, "Get Profile Standard", MinimedTargetType.PumpConfiguration, MedtronicDeviceType.Medtronic_512andHigher, MinimedCommandParameterType.NoParameters, 192, 1, 8, 7), // 146
|
GetBasalProfileSTD(146, "Get Profile Standard", MinimedTargetType.PumpConfiguration, MedtronicDeviceType.Medtronic_512andHigher, MinimedCommandParameterType.NoParameters, 192, 1, 8, 1), // 146
|
||||||
// FIXME
|
|
||||||
|
|
||||||
GetBasalProfileA(147, "Get Profile A", MinimedTargetType.PumpConfiguration, MedtronicDeviceType.Medtronic_512andHigher, MinimedCommandParameterType.NoParameters, 192, 1, 9), // 147
|
GetBasalProfileA(147, "Get Profile A", MinimedTargetType.PumpConfiguration, MedtronicDeviceType.Medtronic_512andHigher, MinimedCommandParameterType.NoParameters, 192, 1, 9), // 147
|
||||||
// FIXME
|
// FIXME
|
||||||
|
|
|
@ -24,6 +24,7 @@ import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkConst
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RFSpy;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RFSpy;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RileyLinkBLE;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.RileyLinkBLE;
|
||||||
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkEncodingType;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkServiceState;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkServiceState;
|
||||||
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkTargetDevice;
|
import info.nightscout.androidaps.plugins.PumpCommon.hw.rileylink.defs.RileyLinkTargetDevice;
|
||||||
|
@ -208,6 +209,12 @@ public class RileyLinkMedtronicService extends RileyLinkService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RileyLinkEncodingType getEncoding() {
|
||||||
|
return RileyLinkEncodingType.FourByteSixByte;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void determineRileyLinkTargetFrequency() {
|
protected void determineRileyLinkTargetFrequency() {
|
||||||
boolean hasUSFrequency = SP.getString(MedtronicConst.Prefs.PumpFrequency,
|
boolean hasUSFrequency = SP.getString(MedtronicConst.Prefs.PumpFrequency,
|
||||||
|
|
|
@ -1230,7 +1230,7 @@
|
||||||
<string name="rileylink_mac_address">RileyLink MAC Address</string>
|
<string name="rileylink_mac_address">RileyLink MAC Address</string>
|
||||||
<string name="rileylink_scanner_selected_device">Selected</string>
|
<string name="rileylink_scanner_selected_device">Selected</string>
|
||||||
<string name="rileylink_scanner_scan">Scan</string>
|
<string name="rileylink_scanner_scan">Scan</string>
|
||||||
<string name="rileylink_scanner_title">RileyLink BLE Scan</string>
|
<string name="rileylink_scanner_title">RileyLink Scan</string>
|
||||||
<string name="rileylink_scanner_scan_menu">Scan for RileyLink</string>
|
<string name="rileylink_scanner_scan_menu">Scan for RileyLink</string>
|
||||||
|
|
||||||
<!-- RL Status Page -->
|
<!-- RL Status Page -->
|
||||||
|
@ -1309,7 +1309,6 @@
|
||||||
<string name="medtronic_cmd_cancel_bolus_not_supported">Remote cancel of Bolus is not supported. If you wish to cancel bolus, go to pump put it in suspend and then resume. This will cancel the bolus.</string>
|
<string name="medtronic_cmd_cancel_bolus_not_supported">Remote cancel of Bolus is not supported. If you wish to cancel bolus, go to pump put it in suspend and then resume. This will cancel the bolus.</string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<plurals name="objective_days">
|
<plurals name="objective_days">
|
||||||
<item quantity="one">%1$d day</item>
|
<item quantity="one">%1$d day</item>
|
||||||
<item quantity="other">%1$d days</item>
|
<item quantity="other">%1$d days</item>
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
</Preference>
|
</Preference>
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
|
android:id="@+id/rileylink_mac_address_mdt"
|
||||||
android:defaultValue="xx:xx:xx:xx:xx:xx"
|
android:defaultValue="xx:xx:xx:xx:xx:xx"
|
||||||
android:editable="false"
|
android:editable="false"
|
||||||
android:inputType="textFilter"
|
android:inputType="textFilter"
|
||||||
|
|
Loading…
Reference in a new issue