Package com.dsi.ant.plugins.antplus.pcc
Class AntPlusWatchDownloaderPcc
java.lang.Object
com.dsi.ant.plugins.antplus.pccbase.AntPluginPcc
com.dsi.ant.plugins.antplus.pcc.AntPlusWatchDownloaderPcc
Enables communication between a client and the WatchDownloader plugin service.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDevice information, used in available devices list and making requestsstatic enumDefines the codes explaining the changes occurring to the device list received by theAntPlusWatchDownloaderPcc.IAvailableDeviceListReceiver.static interfaceReceiver for the AvailableDeviceList event, which is: Broadcasts the current list of devices available to connect to along with information identifying any change since the last update, if applicable.static interfaceReceiver for the download activity commands.classDefines the keys and values used to communicate between the PCC and plugin.Nested classes/interfaces inherited from class com.dsi.ant.plugins.antplus.pccbase.AntPluginPcc
AntPluginPcc.IDeviceStateChangeReceiver, AntPluginPcc.IPluginAccessResultReceiver<T extends AntPluginPcc>, AntPluginPcc.RequestAccessResultHandler<T extends AntPluginPcc>, AntPluginPcc.RequestAccessResultHandler_AsyncSearchByDevNumber<T extends AntPluginPcc>, AntPluginPcc.RequestAccessResultHandler_UI<T extends AntPluginPcc>, AntPluginPcc.StandardReleaseHandle<T extends AntPluginPcc> -
Field Summary
Fields inherited from class com.dsi.ant.plugins.antplus.pccbase.AntPluginPcc
mReleaseHandle, mStateChangeReceiver, PATH_ANTPLUS_PLUGINS_PKG, reportedServiceVersion, supportsRssiEvent -
Method Summary
Modifier and TypeMethodDescriptionbooleancancelListenForNewActivities(UUID targetDeviceUUID) Cancels any listenForNewActivities commands pending for the given device for your application, or cancels all listenForNewActivities commands for all devices if UUID is null.protected Stringprotected intprotected android.content.Intentprotected voidhandlePluginEvent(android.os.Message eventMsg) booleanlistenForNewActivities(UUID targetDeviceUUID, AntPlusWatchDownloaderPcc.IDownloadActivitiesFinishedReceiver downloadActivitiesFinishedReceiver, FitFileCommon.IFitFileDownloadedReceiver fitFileDownloadedReceiver) Submits a request to download all new activities from the target device until the request is cancelled.voidRequests the current device list.requestDeviceListAccess(android.content.Context bindToContext, AntPluginPcc.IPluginAccessResultReceiver<AntPlusWatchDownloaderPcc> resultReceiver, AntPluginPcc.IDeviceStateChangeReceiver stateReceiver, AntPlusWatchDownloaderPcc.IAvailableDeviceListReceiver availableDeviceListRecevier) Send a request to the plugin for access to receive device list updates and make requests.booleanrequestDownloadAllActivities(UUID targetDeviceUUID, AntPlusWatchDownloaderPcc.IDownloadActivitiesFinishedReceiver downloadActivitiesFinishedReceiver, FitFileCommon.IFitFileDownloadedReceiver fitFileDownloadedReceiver, AntFsCommon.IAntFsProgressUpdateReceiver antFsProgressUpdateRecevier) Requests a download of all activities from the device.booleanrequestDownloadNewActivities(UUID targetDeviceUUID, AntPlusWatchDownloaderPcc.IDownloadActivitiesFinishedReceiver downloadActivitiesFinishedReceiver, FitFileCommon.IFitFileDownloadedReceiver fitFileDownloadedReceiver, AntFsCommon.IAntFsProgressUpdateReceiver antFsProgressUpdateRecevier) Requests a download of all new activities from the device.Methods inherited from class com.dsi.ant.plugins.antplus.pccbase.AntPluginPcc
bindAndRequest, closePluginConnection, createCmdMsg, getAntDeviceNumber, getCurrentDeviceState, getDeviceName, getInstalledPluginsVersionNumber, getInstalledPluginsVersionString, getMissingDependencyName, getMissingDependencyPackageName, handleNonCmdPluginMessage, isUserPreferredDeviceForPlugin, isUserRecognizedDevice, releaseAccess, requestAccess_Helper_AsyncScanController, requestAccess_Helper_AsyncSearchByDevNumber, requestAccess_Helper_Main, requestAccess_Helper_SearchActivity, requestAccess_Helper_SubMain, requestAsyncScan_Helper_SubMain, sendPluginCommand, sendPluginCommand, startPluginManagerActivity, subscribeToEvent, unsubscribeFromEvent
-
Method Details
-
getRequiredServiceVersionForBind
protected int getRequiredServiceVersionForBind()- Specified by:
getRequiredServiceVersionForBindin classAntPluginPcc
-
requestDeviceListAccess
public static PccReleaseHandle<AntPlusWatchDownloaderPcc> requestDeviceListAccess(android.content.Context bindToContext, AntPluginPcc.IPluginAccessResultReceiver<AntPlusWatchDownloaderPcc> resultReceiver, AntPluginPcc.IDeviceStateChangeReceiver stateReceiver, AntPlusWatchDownloaderPcc.IAvailableDeviceListReceiver availableDeviceListRecevier) Send a request to the plugin for access to receive device list updates and make requests.- Parameters:
bindToContext- The context to which the plugin will be bound. Used for plugin lifecycle management.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, if 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.availableDeviceListRecevier- Receives the available device list and updates to that list. CallrequestCurrentDeviceList()after receiving access to get the current list.- 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.
-
getServiceBindIntent
protected android.content.Intent getServiceBindIntent()- Specified by:
getServiceBindIntentin classAntPluginPcc
-
getPluginPrintableName
- Specified by:
getPluginPrintableNamein classAntPluginPcc
-
handlePluginEvent
protected void handlePluginEvent(android.os.Message eventMsg) - Specified by:
handlePluginEventin classAntPluginPcc
-
requestCurrentDeviceList
public void requestCurrentDeviceList()Requests the current device list. The list will come in on the receiver passed torequestDeviceListAccess(Context, IPluginAccessResultReceiver, IDeviceStateChangeReceiver, IAvailableDeviceListReceiver). -
requestDownloadAllActivities
public boolean requestDownloadAllActivities(UUID targetDeviceUUID, AntPlusWatchDownloaderPcc.IDownloadActivitiesFinishedReceiver downloadActivitiesFinishedReceiver, FitFileCommon.IFitFileDownloadedReceiver fitFileDownloadedReceiver, AntFsCommon.IAntFsProgressUpdateReceiver antFsProgressUpdateRecevier) Requests a download of all activities from the device.- Parameters:
targetDeviceUUID- The target device to make the request on.downloadActivitiesFinishedReceiver- The receiver to receive the status of the file download.fitFileDownloadedReceiver- The receiver to receive each downloaded file from the device as it is downloaded over ANT-FS.antFsProgressUpdateRecevier- Optional. The receiver to receive the state updates of the ANT-FS connection or null.- Returns:
- True if request was submitted successfully and you are guaranteed a result on the result receiver.
-
requestDownloadNewActivities
public boolean requestDownloadNewActivities(UUID targetDeviceUUID, AntPlusWatchDownloaderPcc.IDownloadActivitiesFinishedReceiver downloadActivitiesFinishedReceiver, FitFileCommon.IFitFileDownloadedReceiver fitFileDownloadedReceiver, AntFsCommon.IAntFsProgressUpdateReceiver antFsProgressUpdateRecevier) Requests a download of all new activities from the device.- Parameters:
targetDeviceUUID- The target device to make the request on.downloadActivitiesFinishedReceiver- The receiver to receive the status of the file download.fitFileDownloadedReceiver- The receiver to receive each downloaded file from the device as it is downloaded over ANT-FS.antFsProgressUpdateRecevier- Optional. The receiver to receive the state updates of the ANT-FS connection or null.- Returns:
- True if request was submitted successfully and you are guaranteed a result on the result receiver.
-
listenForNewActivities
public boolean listenForNewActivities(UUID targetDeviceUUID, AntPlusWatchDownloaderPcc.IDownloadActivitiesFinishedReceiver downloadActivitiesFinishedReceiver, FitFileCommon.IFitFileDownloadedReceiver fitFileDownloadedReceiver) Submits a request to download all new activities from the target device until the request is cancelled. This function will cause the plugin to automatically check periodically for new activities. This function will cancel and override any existing listenForNewActivities for the target device.- Parameters:
targetDeviceUUID- The target device to make the request on.downloadActivitiesFinishedReceiver- The receiver to receive the status of the file download.fitFileDownloadedReceiver- The receiver to receive each downloaded file from the device as it is downloaded over ANT-FS.- Returns:
- True if request was submitted successfully. False if the device UUID is not valid.
-
cancelListenForNewActivities
Cancels any listenForNewActivities commands pending for the given device for your application, or cancels all listenForNewActivities commands for all devices if UUID is null.- Parameters:
targetDeviceUUID- The target device to cancel commands for, or null to cancel all commands from your application.- Returns:
- True if the target command(s) are cancelled. False if there was an error cancelling the commands.
-