use of com.eveningoutpost.dexdrip.ImportedLibraries.usbserial.driver.UsbSerialDriver in project xDrip by NightscoutFoundation.
the class SyncingService method acquireSerialDevice.
private boolean acquireSerialDevice() {
UsbDevice found_device = findDexcom();
if (mUsbManager == null) {
Log.w("CALIBRATION-CHECK-IN: ", "USB manager is null");
return false;
}
if (dexcom == null) {
Log.e(TAG, "dex device == null");
return false;
}
if (mUsbManager.hasPermission(dexcom)) {
// the system is allowing us to poke around this device
// From the USB library...
ProbeTable customTable = new ProbeTable();
// ...Specify the Vendor ID and Product ID
customTable.addProduct(0x22A3, 0x0047, CdcAcmSerialDriver.class);
// Probe the device with the custom values
UsbSerialProber prober = new UsbSerialProber(customTable);
// let's go through the list
List<UsbSerialDriver> drivers = prober.findAllDrivers(mUsbManager);
// Invalid Return code
Iterator<UsbSerialDriver> foo = drivers.iterator();
while (foo.hasNext()) {
// let's loop through
// set fooDriver to the next available driver
UsbSerialDriver driver = foo.next();
if (driver != null) {
UsbDeviceConnection connection = mUsbManager.openDevice(driver.getDevice());
if (connection != null) {
mSerialDevice = driver;
mConnection = connection;
Log.i("CALIBRATION-CHECK-IN: ", "CONNECTEDDDD!!");
return true;
}
} else {
Log.w("CALIBRATION-CHECK-IN: ", "Driver was no good");
}
}
Log.w("CALIBRATION-CHECK-IN: ", "No usable drivers found");
} else {
Log.w("CALIBRATION-CHECK-IN: ", "You dont have permissions for that dexcom!!");
}
return false;
}
use of com.eveningoutpost.dexdrip.ImportedLibraries.usbserial.driver.UsbSerialDriver in project xDrip-plus by jamorham.
the class SyncingService method acquireSerialDevice.
private boolean acquireSerialDevice() {
UsbDevice found_device = findDexcom();
if (mUsbManager == null) {
Log.w("CALIBRATION-CHECK-IN: ", "USB manager is null");
return false;
}
if (dexcom == null) {
Log.e(TAG, "dex device == null");
return false;
}
if (mUsbManager.hasPermission(dexcom)) {
// the system is allowing us to poke around this device
// From the USB library...
ProbeTable customTable = new ProbeTable();
// ...Specify the Vendor ID and Product ID
customTable.addProduct(0x22A3, 0x0047, CdcAcmSerialDriver.class);
// Probe the device with the custom values
UsbSerialProber prober = new UsbSerialProber(customTable);
// let's go through the list
List<UsbSerialDriver> drivers = prober.findAllDrivers(mUsbManager);
// Invalid Return code
Iterator<UsbSerialDriver> foo = drivers.iterator();
while (foo.hasNext()) {
// let's loop through
// set fooDriver to the next available driver
UsbSerialDriver driver = foo.next();
if (driver != null) {
UsbDeviceConnection connection = mUsbManager.openDevice(driver.getDevice());
if (connection != null) {
mSerialDevice = driver;
mConnection = connection;
Log.i("CALIBRATION-CHECK-IN: ", "CONNECTEDDDD!!");
return true;
}
} else {
Log.w("CALIBRATION-CHECK-IN: ", "Driver was no good");
}
}
Log.w("CALIBRATION-CHECK-IN: ", "No usable drivers found");
} else {
Log.w("CALIBRATION-CHECK-IN: ", "You dont have permissions for that dexcom!!");
}
return false;
}
Aggregations