|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--Garmin.DeviceControl
Garmin.DeviceControl
The controller must be unlocked before anything can be done with it.
Then you'll have to find a device before you can start to read data from
and write data to the device.
We use the observer pattern
to handle the asynchronous nature of device communication. You must register
your class as a listener to this Object and then implement methods that will
get called on certain events.
Events:
onStartFindDevices called when starting to search for devices.
the object returned is {controller: this}
onCancelFindDevices is called when the controller is told to cancel finding
devices {controller: this}
onFinishFindDevices called when the devices are found.
the object returned is {controller: this}
onException is called when an exception occurs in a method
object passed back is {msg: exception}
onInteractionWithNoDevice is called when the device is lazy loaded, but finds no devices,
yet still attempts a read/write action {controller: this}
onStartReadFromDevice is called when the controller is about to start
reading from the device {controller: this}
onFinishReadFromDevice is called when the controller is done reading
the device. the read is either a success or failure, which is
communicated via json. object passed back contains
{success:this.garminPlugin.GpsTransferSucceeded, controller: this}
onWaitingReadFromDevice is called when the controller is waiting for input
from the user about the device. object passed back contains:
{message: this.garminPlugin.MessageBoxXml, controller: this}
onProgressReadFromDevice is called when the controller is still reading information
from the device. in this case the message is a percent complete/
{progress: this.getDeviceStatus(), controller: this}
onCancelReadFromDevice is called when the controller is told to cancel reading
from the device {controller: this}
onFinishWriteToDevice is called when the controller is done writing to
the device. the write is either a success or failure, which is
communicated via json. object passed back contains
{success:this.garminPlugin.GpsTransferSucceeded, controller: this}
onWaitingWriteToDevice is called when the controller is waiting for input
from the user about the device. object passed back contains:
{message: this.garminPlugin.MessageBoxXml, controller: this}
onProgressWriteToDevice is called when the controller is still writing information
to the device. in this case the message is a percent complete/
{progress: this.getDeviceStatus(), controller: this}
onCancelWriteToDevice is called when the controller is told to cancel writing
to the device {controller: this}
Defined in GarminDeviceControl.js
Requires:
| Field Summary | |
<static> Object |
FILE_TYPES
Constants defining possible file types associated with read and write methods. |
<static> Object |
FINISH_STATES
Constants defining possible states when you poll the finishActions |
<static> Object |
MESSAGES
Constants defining possible errors messages for various errors on the page |
<static> Object |
REQUIRED_VERSION
Current Version of the Garmin Communicator Plugin, and a complementary toString function to print it out with |
<static> Object |
TRANSFER_DIRECTIONS
Constants defining the strings used by the Device.xml to indicate transfer direction of each file type |
| Constructor Summary | |
Garmin.DeviceControl()
A controller object that can retrieve and send data to a Garmin device. |
|
| Method Summary | |
void
|
cancelFindDevices()
Cancels the current find devices interaction. |
void
|
cancelReadFromDevice()
User canceled the read. |
void
|
cancelWriteToDevice()
Cancels the current write transfer to the device. |
void
|
downloadToDevice(xmlDownloadDescription, filename)
Writes GPI info to the currently selected device. |
void
|
findDevices()
Finds any connected Garmin Devices. |
Object
|
getCompressedFitnessData()
Returns the last read fitness data in compressed format. |
Array
|
getDevices()
Get a list of the devices found |
Garmin.TransferProgress
|
getDeviceStatus()
Get the status/progress of the current state or transfer |
Object
|
getGpsData()
Returns the GPS data that was last read as an XML DOM. |
Object
|
getGpsDataString()
Returns the GPS data that was last read as an XML string. |
Array
|
getPluginVersion()
Gets the version number for the plugin the user has currently installed. |
String
|
getPluginVersionString()
Gets a string of the version number for the plugin the user has currently installed. |
Number
|
getReadCompletionState()
Returns the completion state of the current read. |
void
|
initialize()
Instantiates a Garmin.DeviceControl object, but does not unlock/activate plugin. |
Boolean
|
isPluginInitialized()
Determines if the plugin is initialized |
Boolean
|
isPluginInstalled()
Determines if the plugin is installed on the user's machine |
Boolean
|
isPluginOutOfDate()
Determines if the Garmin plugin is the required version or a newer version for this JavaScript library. |
Boolean
|
isUnlocked()
True if plugin has been successfully created and unlocked. |
void
|
readCourseDetailFromFitnessDevice(<String> courseId)
Asynchronously reads a single fitness course from the connected device as TCX format. |
void
|
readCoursesFromFitnessDevice()
Asynchronously reads entire fitness course data (CRS) from the connected device. |
void
|
readDataFromDevice(<String> fileType)
Generic read method, supporting GPX, TCX, Courses, Workouts, User Profiles, TCX activity directory, and TCX course directory reads. |
void
|
readDetailFromDevice(<String> fileType, <String> dataId)
Generic detail read method, which reads a specific fitness activity from the device given an activity ID. |
void
|
readFromDevice()
Asynchronously reads GPX data from the connected device. |
void
|
readHistoryDetailFromFitnessDevice(<String> historyId)
Asynchronously reads a single fitness history record from the connected device as TCX format. |
void
|
readHistoryFromFitnessDevice()
Asynchronously reads entire fitness history data (TCX) from the connected device. |
void
|
readUserProfileFromFitnessDevice()
Asynchronously reads fitness profile data (TCX) from the connected device. |
void
|
readWorkoutsFromFitnessDevice()
Asynchronously reads fitness workout data (WKT) from the connected device. |
void
|
register(<Object> listener)
Register to be an event listener. |
void
|
respondToMessageBox(<Number> response)
Responds to a message box on the device. |
void
|
setDeviceNumber(<Number> deviceNumber)
Sets the deviceNumber variable which determines which connected device to talk to. |
Boolean
|
unlock(<Array> pathKeyPairsArray)
Unlocks the GpsControl object to be used at the given web address. |
void
|
writeAddressToDevice(<String> address)
Writes an address to the currently selected device. |
void
|
writeFitnessToDevice(tcxString, fileName)
Writes the given TCX Course XML string to the device selected in this.deviceNumber. |
void
|
writeToDevice(gpxString, fileName)
Writes the given GPX XML string to the device selected in this.deviceNumber. |
void
|
writeUserProfileToFitnessDevice(tcxString, fileName)
Writes the given TCX User Profile XML string to the device selected in this.deviceNumber. |
void
|
writeWorkoutsToFitnessDevice(tcxString, fileName)
Writes the given TCX Workouts XML string to the device selected in this.deviceNumber. |
| Field Detail |
<static> Object FILE_TYPES
<static> Object FINISH_STATES
<static> Object MESSAGES
<static> Object REQUIRED_VERSION
<static> Object TRANSFER_DIRECTIONS
| Constructor Detail |
Garmin.DeviceControl()
| Method Detail |
void cancelFindDevices()
void cancelReadFromDevice()
void cancelWriteToDevice()
void downloadToDevice(xmlDownloadDescription, filename)
xmlDownloadDescription - {String} xml string to be written to the device.
fileName - {String} the filename to write the data to.
void findDevices()
Object getCompressedFitnessData()
ArraygetDevices()
Garmin.TransferProgress getDeviceStatus()
Object getGpsData()
Object getGpsDataString()
Array getPluginVersion()
String getPluginVersionString()
Number getReadCompletionState()
void initialize()
Boolean isPluginInitialized()
Boolean isPluginInstalled()
Boolean isPluginOutOfDate()
Boolean isUnlocked()
void readCourseDetailFromFitnessDevice(<String> courseId)
courseId - The name of the course on the device.
void readCoursesFromFitnessDevice()
void readDataFromDevice(<String> fileType)
fileType - Possible values for fileType are located in Garmin.DeviceControl.FILE_TYPES--detail types are not supported.
void readDetailFromDevice(<String> fileType, <String> dataId)
fileType - Filetype to be read from the device. Supported values are Garmin.DeviceControl.FILE_TYPES.tcxDetail and Garmin.DeviceControl.FILE_TYPES.crsDetail
dataId - The ID of the data to be read from the device. The format of these values depends on the type of data being read (i.e. course data or history data). The CourseName element in the course schema is used to identify courses, and the Id element is used to identify history activities.
void readFromDevice()
void readHistoryDetailFromFitnessDevice(<String> historyId)
historyId - The ID of the history record on the device.
void readHistoryFromFitnessDevice()
void readUserProfileFromFitnessDevice()
void readWorkoutsFromFitnessDevice()
void register(<Object> listener)
listener - Object that will listen for events coming from this object
void respondToMessageBox(<Number> response)
response - should be an int which corresponds to a button value from this.garminPlugin.MessageBoxXml
void setDeviceNumber(<Number> deviceNumber)
deviceNumber - The device number
Boolean unlock(<Array> pathKeyPairsArray)
pathKeyPairsArray - baseURL and key pairs.
void writeAddressToDevice(<String> address)
address - The address to be written to the device. This doesn't check validity
void writeFitnessToDevice(tcxString, fileName)
tcxString - {String} TCX Course XML string to be written to the device. This doesn't check validity.
fileName - {String} filename to write data to on the device. Validity is not checked here.
void writeToDevice(gpxString, fileName)
gpxString - XML to be written to the device. This doesn't check validity.
fileName - The filename to write data to. Validity is not checked here.
void writeUserProfileToFitnessDevice(tcxString, fileName)
tcxString - XML (user profile) string to be written to the device. This doesn't check validity.
fileName - String of filename to write it to on the device. Validity is not checked here.
void writeWorkoutsToFitnessDevice(tcxString, fileName)
tcxString - XML (workouts) string to be written to the device. This doesn't check validity.
fileName - String of filename to write it to on the device. Validity is not checked here.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||