public abstract class WatchInterface extends Object
Modifier and Type | Class and Description |
---|---|
static class |
WatchInterface.FileType
This enum defines the file type.
|
Modifier and Type | Field and Description |
---|---|
static int |
FILEID_BLE_FIRMWARE |
static int |
FILEID_BLE_UPDATE_LOG |
static int |
FILEID_GPS_FIRMWARE |
static int |
FILEID_GPSQUICKFIX_DATA |
static int |
FILEID_INVALID |
static int |
FILEID_LOG |
static int |
FILEID_MANIFEST1 |
static int |
FILEID_MANIFEST2 |
static int |
FILEID_PLAYLIST |
static int |
FILEID_PREFERENCES_XML |
static int |
FILEID_SYSTEM_FIRMWARE |
static int |
FILEID_UPDATE_LOG |
protected ArrayList<UsbFile> |
fileList |
protected ProgressListener |
listener |
protected UsbFile |
preferenceFile
The preference file of the watch
|
static int |
PRODUCTID_UNKNOWN |
protected static int |
TTWATCH_FILE_TYPE_MASK |
Modifier | Constructor and Description |
---|---|
protected |
WatchInterface()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
closeConnection()
Closes the USB connection
|
abstract boolean |
deleteFile(UsbFile file)
Deletes the file on the watch indicated by the ID in the file
passed.
|
abstract boolean |
fileExists(int fileId)
This method checks if a file exists
|
boolean |
formatDevice()
This method formats the device
|
abstract String |
getDeviceSerialNumber()
Returns the serial number of the device.
|
abstract ArrayList<UsbFile> |
getFileList(WatchInterface.FileType fileType)
This method requests the list of file of given type
|
String |
getPreference(String tag)
This method returns the preference from the watch XML preference file
indicated by the tag.
|
abstract int |
getProductId()
This method returns the firmware version
|
abstract hirondelle.date4j.DateTime |
getWatchTime()
This method retrieves the time from the watch.
|
boolean |
isFileType(UsbFile file,
WatchInterface.FileType type)
THis method evaluates the file and indicates whether it is a file
of indicated file type
|
boolean |
openConnection()
Opens the USB connection
|
abstract String |
readBleVersion()
This method returns the BLE (Bluetooth Low Energy) version
|
abstract boolean |
readFile(UsbFile file)
This method reads the file with file ID defined in the file
instance passed from the watch
|
abstract String |
readFirmwareVersion()
This method returns the firmware version
|
UsbFile |
readPreferences()
This method reads and returns the preferences from the watch.
|
boolean |
resetDevice()
Execute device reset
|
boolean |
resetGpsProcessor()
Resets the GPS processor
|
boolean |
sendMessageGroup1()
Another message sequence reported by ttwatch
|
boolean |
sendStartupSequence()
According to ttwatch (Ryan Binns) this is the sequence that should be
called after opening the watch connection
|
boolean |
setPreference(String tag,
String value)
Write a preference in the preference file to the watch
|
void |
setProgressListener(ProgressListener listener)
This method sets the progress listener for file reading and writing.
|
abstract boolean |
writeFile(UsbFile file)
Write file to the watch.
|
boolean |
writeGpxQuickFixFile(byte[] quickFixFile)
Write the GPS Quickfix file
|
boolean |
writePreferences()
Write the preference file to the watch.
|
boolean |
writeVerifyFile(UsbFile file)
This method writes the file, reads it back and verifies it
|
public static final int FILEID_BLE_FIRMWARE
public static final int FILEID_SYSTEM_FIRMWARE
public static final int FILEID_GPSQUICKFIX_DATA
public static final int FILEID_GPS_FIRMWARE
public static final int FILEID_BLE_UPDATE_LOG
public static final int FILEID_UPDATE_LOG
public static final int FILEID_LOG
public static final int FILEID_MANIFEST1
public static final int FILEID_MANIFEST2
public static final int FILEID_PLAYLIST
public static final int FILEID_PREFERENCES_XML
public static final int FILEID_INVALID
public static final int PRODUCTID_UNKNOWN
protected static final int TTWATCH_FILE_TYPE_MASK
protected ProgressListener listener
protected UsbFile preferenceFile
public boolean openConnection()
public void closeConnection()
public boolean sendStartupSequence()
public boolean sendMessageGroup1()
public void setProgressListener(ProgressListener listener)
listener
- The listenerpublic abstract boolean fileExists(int fileId)
fileId
- Id of the file to checkpublic abstract boolean readFile(UsbFile file)
file
- File defining the file ID. The file data is read into
this file instancepublic abstract boolean writeFile(UsbFile file)
file
- The file to writepublic boolean writeVerifyFile(UsbFile file)
file
- The file to writepublic boolean writeGpxQuickFixFile(byte[] quickFixFile)
quickFixFile
- The quick fix file datapublic abstract boolean deleteFile(UsbFile file)
file
- File defining the file ID to deletepublic abstract ArrayList<UsbFile> getFileList(WatchInterface.FileType fileType)
fileType
- The type of files to requestpublic abstract hirondelle.date4j.DateTime getWatchTime()
public UsbFile readPreferences()
public boolean writePreferences()
public String getPreference(String tag)
tag
- Tag in the XML file, without the bracespublic boolean setPreference(String tag, String value)
tag
- Tag of the preferencevalue
- Value of the preferencepublic abstract String readBleVersion()
public abstract String readFirmwareVersion()
public abstract int getProductId()
public abstract String getDeviceSerialNumber()
public boolean isFileType(UsbFile file, WatchInterface.FileType type)
file
- File to evaluatetype
- Type to check againstpublic boolean resetDevice()
public boolean resetGpsProcessor()
public boolean formatDevice()
Copyright © 2019. All rights reserved.