public class CommunicationProcess extends Object implements Runnable, ProgressListener
Modifier and Type | Field and Description |
---|---|
static int |
MAXROUTES |
Constructor and Description |
---|
CommunicationProcess(WatchInterface watchInterface)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addRouteFile(String name,
String file,
int index)
This method loads and adds a route file to the array with route files
|
void |
clear()
Removes any track data.
|
void |
deleteAllRouteFiles()
Remove all route files from the array
|
void |
deleteRouteFile(int index)
Remote selected route from the array
|
ActivityData |
getActivityData(int index)
Get the ActivityData based on the index in the array
|
String |
getDeviceName()
Returns the device name
|
UsbFile |
getRouteFile(int index)
Returns route from array at given index.
|
boolean |
isConnected()
Indicates whether a watch is connected or not
|
boolean |
listHistory(WatchInterface watchInterface)
This method lists the device history
|
boolean |
loadActivityFromTtbinFile()
Load the activity from a ttbin file.
|
void |
pushCommand(ThreadCommand command)
Push a command for executing on the command queue
|
void |
reportReadProgress(int bytesRead)
This method reports the progress file reading
|
void |
reportWriteProgress(int bytesWritten)
This method reports the progress file writing
|
void |
requestDeleteDeviceFileFromWatch(int fileId)
Deletes the file from the watch.
|
void |
requestLoadActivityFromTtbinFile(String fileName)
Loads the activity from a ttbin file on disk
|
void |
requestSetNewDeviceName(String name)
Writes a new device name to the watch.
|
void |
requestShowFile(int fileId)
This method requests to display the contents of indicated file.
|
void |
requestStop()
Stop the process.
|
void |
requestUploadFile(String fileName)
Request the upload of a file from disk to the watch
|
void |
requestUploadGpxFile(String file,
String name)
Converts and upload a GPX route file.
|
void |
requestWriteDeviceFileToDisk(int fileId)
Writes a file from the watch as binary file to disk.
|
void |
run()
Process executing the communication commands
|
boolean |
saveSimulationSet(WatchInterface watchInterface)
This method save a 'simulation set'.
|
void |
setTrackSmoothing(boolean enabled,
float qFactor)
This method sets the track smoothing.
|
void |
startProcess(TomTomWatchView view)
Set the view and start the processing
|
public static final int MAXROUTES
public CommunicationProcess(WatchInterface watchInterface)
watchInterface
- Interface to the watch to usepublic void startProcess(TomTomWatchView view)
view
- TomTomWatchView instancepublic void pushCommand(ThreadCommand command)
command
- Command to push on the queuepublic void requestSetNewDeviceName(String name)
name
- The new namepublic void requestLoadActivityFromTtbinFile(String fileName)
fileName
- THe file to loadpublic void requestWriteDeviceFileToDisk(int fileId)
fileId
- Id of the filepublic void requestUploadFile(String fileName)
fileName
- The file to uploadpublic void requestDeleteDeviceFileFromWatch(int fileId)
fileId
- Id of the filepublic void requestUploadGpxFile(String file, String name)
file
- Filename of the file to uploadname
- Name of the route by which it becomes visible on the
watchpublic void requestShowFile(int fileId)
fileId
- ID of file to showpublic void requestStop()
public ActivityData getActivityData(int index)
index
- Array indexpublic boolean isConnected()
public String getDeviceName()
public void setTrackSmoothing(boolean enabled, float qFactor)
enabled
- Indicates whether smoothing is enabledqFactor
- The Q Factor for smoothingpublic void addRouteFile(String name, String file, int index)
name
- Name of the routefile
- File name of the route gpx fileindex
- Location in the array to add the route file topublic void deleteAllRouteFiles()
public void deleteRouteFile(int index)
index
- Location of the route filepublic UsbFile getRouteFile(int index)
index
- Location of the route file in the arraypublic void run()
public void clear()
public void reportReadProgress(int bytesRead)
reportReadProgress
in interface ProgressListener
bytesRead
- Number of bytes that have been writtenpublic void reportWriteProgress(int bytesWritten)
reportWriteProgress
in interface ProgressListener
bytesWritten
- Number of bytes that have been writtenpublic boolean loadActivityFromTtbinFile()
public boolean listHistory(WatchInterface watchInterface)
watchInterface
- USB interface to usepublic boolean saveSimulationSet(WatchInterface watchInterface)
watchInterface
- USB interface to useCopyright © 2019. All rights reserved.