...
Additionally, users will need to add a dependency for the Serial Java library used by the SDK. This can be done b by modifying the settings.gradle file with the following highlighted lines…lines:
...
…and adding a reference to the git repo for the serial library to the VictoRCommunications relevant module.
...
Device Manager
Instantiation
...
Code Block | ||
---|---|---|
| ||
import com.fn.victorcommunications.VictorBleDeviceManager; public class MainActivity extends Activity { VictorBleDeviceManager deviceManager; @Override public void onCreate(Bundle savedInstanceState) { deviceManager = new VictorBleDeviceManager(this); } } |
USB
Code Block | ||
---|---|---|
| ||
import com.fn.victorcommunications.VictorUsbDeviceManager; public class MainActivity extends Activity { VictorUsbDeviceManager deviceManager; @Override public void onCreate(Bundle savedInstanceState) { deviceManager = new VictorUsbDeviceManager(this); } } |
...
Code Block | ||
---|---|---|
| ||
private final DeviceInformationService.DeviceInformationCallback deviceInformationCallback = new DeviceInformationService.DeviceInformationCallback() { public void onCurrentBatteryLevelChanged(VictorDeviceInfo deviceInfo, short currentBatteryLevel) { debugTextView.post(() -> debugTextView.append("Current Battery Level: " + currentBatteryLevel + "\n")); } }; deviceInfoService.subscribeToCurrentBatteryLevel(deviceInfo.getAddress(), deviceInformationCallback); |
It is important to note that as of the ICD referenced at the start of this guide, the VictoR device does not support subscribing to battery level over USBNOTE: When subscribing to an attribute, please reference the supported ICD document specified above to ensure that subscribing to the attribute itself supported.