Class AntPlusBikeSpdCadCommonPcc.BikeSpdCadAsyncScanController<T extends AntPlusBikeSpdCadCommonPcc>
java.lang.Object
com.dsi.ant.plugins.antplus.pccbase.AsyncScanController<T>
com.dsi.ant.plugins.antplus.pccbase.AntPlusBikeSpdCadCommonPcc.BikeSpdCadAsyncScanController<T>
- Type Parameters:
T
- The type of plugin PCC the scan is attempting to connect to.
- Enclosing class:
- AntPlusBikeSpdCadCommonPcc
public static class AntPlusBikeSpdCadCommonPcc.BikeSpdCadAsyncScanController<T extends AntPlusBikeSpdCadCommonPcc>
extends AsyncScanController<T>
Controls a scan for devices available to connect to, and requesting access to one of those available devices.
The scan is not closed until a device is connected or a failure occurs.
If you have an open async scan controller you must ensure it is closed;
you can know the scan is closed if any of the following happen:
- You call
AsyncScanController.closeScanController()
- Your
AsyncScanController.IAsyncScanResultReceiver.onSearchStopped(com.dsi.ant.plugins.antplus.pcc.defines.RequestAccessResult)
callback is called - You successfully request access to a device using
requestDeviceAccess(AsyncScanResultDeviceInfo, IPluginAccessResultReceiver, IDeviceStateChangeReceiver)
- You call
PccReleaseHandle.close()
on the release handle received after requesting access
-
Nested Class Summary
Nested classes/interfaces inherited from class com.dsi.ant.plugins.antplus.pccbase.AsyncScanController
AsyncScanController.AsyncScanResultDeviceInfo, AsyncScanController.IAsyncScanResultReceiver
-
Field Summary
Fields inherited from class com.dsi.ant.plugins.antplus.pccbase.AsyncScanController
scanResultReceiver
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
handleReqAccSuccess
(android.os.Message msg, T retPccObject, AntPluginPcc.IPluginAccessResultReceiver<T> resultReceiver) requestDeviceAccess
(AntPlusBikeSpdCadCommonPcc.BikeSpdCadAsyncScanResultDeviceInfo deviceToConnectTo, AntPluginPcc.IPluginAccessResultReceiver<T> resultReceiver, AntPluginPcc.IDeviceStateChangeReceiver stateReceiver) Sends a request to access the selected device and receive a live PCC instance.requestDeviceAccess
(AsyncScanController.AsyncScanResultDeviceInfo deviceToConnectTo, AntPluginPcc.IPluginAccessResultReceiver<T> resultReceiver, AntPluginPcc.IDeviceStateChangeReceiver stateReceiver) For legacy compatibility.protected void
sendFailureToReceiver
(RequestAccessResult requestAccessResult) protected void
sendResultToReceiver
(android.os.Bundle result) Methods inherited from class com.dsi.ant.plugins.antplus.pccbase.AsyncScanController
closeScanController, getMissingDependencyName, getMissingDependencyPackageName, getScanResultHandler, requestDeviceAccess
-
Method Details
-
sendFailureToReceiver
- Overrides:
sendFailureToReceiver
in classAsyncScanController<T extends AntPlusBikeSpdCadCommonPcc>
-
sendResultToReceiver
protected void sendResultToReceiver(android.os.Bundle result) - Overrides:
sendResultToReceiver
in classAsyncScanController<T extends AntPlusBikeSpdCadCommonPcc>
-
handleReqAccSuccess
protected void handleReqAccSuccess(android.os.Message msg, T retPccObject, AntPluginPcc.IPluginAccessResultReceiver<T> resultReceiver) - Overrides:
handleReqAccSuccess
in classAsyncScanController<T extends AntPlusBikeSpdCadCommonPcc>
-
requestDeviceAccess
public PccReleaseHandle<T> requestDeviceAccess(AntPlusBikeSpdCadCommonPcc.BikeSpdCadAsyncScanResultDeviceInfo deviceToConnectTo, AntPluginPcc.IPluginAccessResultReceiver<T> resultReceiver, AntPluginPcc.IDeviceStateChangeReceiver stateReceiver) Sends a request to access the selected device and receive a live PCC instance. This will pause the scan and start an asynchronous search for the device and return the result on the provided result receiver. The search will timeout after 10s, after which the async scan will resume and you can retry if you wish.- Parameters:
deviceToConnectTo
- The bike device to attempt to connect to.resultReceiver
- The receiver to receive the results of the request. Possible returns include:stateReceiver
- The receiver to receive the state updates of the accessed device, assuming the request is successful. This receiver will receive notifications of all state changes to the device that occur subsequent to the initial state returned in the result receiver.- Returns:
- A release handle for the device. This can be used to guarantee the device is properly shutdown and cleaned up, even before the device is actually received through the result receiver. Calling close on the release handle will additionally stop the asnc scan regardless of the access request result.
-
requestDeviceAccess
public PccReleaseHandle<T> requestDeviceAccess(AsyncScanController.AsyncScanResultDeviceInfo deviceToConnectTo, AntPluginPcc.IPluginAccessResultReceiver<T> resultReceiver, AntPluginPcc.IDeviceStateChangeReceiver stateReceiver) For legacy compatibility. Do not use this method, instead userequestDeviceAccess(BikeSpdCadAsyncScanResultDeviceInfo, IPluginAccessResultReceiver, IDeviceStateChangeReceiver)
. Using this old method may result in non-combo device searches connecting to combo devices with the same device number and vice versa. Additionally, on old Plugin Service versions this method will not connect to combo sensors at all.- Overrides:
requestDeviceAccess
in classAsyncScanController<T extends AntPlusBikeSpdCadCommonPcc>
- Parameters:
deviceToConnectTo
- The device to attempt to connect to.resultReceiver
- The receiver to receive the results of the request. Possible returns include:stateReceiver
- The receiver to receive the state updates of the accessed device, assuming the request is successful. This receiver will receive notifications of all state changes to the device that occur subsequent to the initial state returned in the result receiver.- Returns:
- A release handle for the device. This can be used to guarantee the device is properly shutdown and cleaned up, even before the device is actually received through the result receiver. Calling close on the release handle will additionally stop the asnc scan regardless of the access request result.
-