|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--Garmin.DeviceControl
Garmin.DeviceControl
A controller object that can retrieve and send data to a Garmin
device.
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 (http://en.wikipedia.org/wiki/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
| Constructor Summary | |
Garmin.DeviceControl()
|
|
| Method Summary | |
void
|
__Garmin.DeviceControl.cancelFindDevices()
Cancels the current find devices interaction |
void
|
__Garmin.DeviceControl.cancelReadFromDevice()
Cancels the current read from the device |
void
|
__Garmin.DeviceControl.cancelWriteToDevice()
Cancels the current write transfer to the device |
void
|
__Garmin.DeviceControl.downlaodToDevice(gpiDataString, filename)
Writes GPI info to the device selected in this.deviceNumber. |
void
|
__Garmin.DeviceControl.findDevices()
Finds any connected Garmin Devices. |
Array
|
__Garmin.DeviceControl.getDevices()
Get a list of the devices found |
Garmin.TransferProgress
|
__Garmin.DeviceControl.getDeviceStatus()
Get the status/progress of the current state or transfer |
Array
|
__Garmin.DeviceControl.getPluginVersion()
Gets the version number for the plugin the user has currently installed |
String
|
__Garmin.DeviceControl.getPluginVersionString()
Gets a string of the version number for the plugin the user has currently installed |
Object
|
__Garmin.DeviceControl.initialize()
Instantiates a Garmin.DeviceControl object |
Boolean
|
__Garmin.DeviceControl.isBrowserSupported()
Determines if the users browser is currently supported by the plugin |
Boolean
|
__Garmin.DeviceControl.isPluginInitialized()
Determines if the plugin is initialized |
Boolean
|
__Garmin.DeviceControl.isPluginInstalled()
Determines if the plugin is installed on the user's machine |
Boolean
|
__Garmin.DeviceControl.isPluginOutOfDate()
Determines if the Garmin agent is the current version. |
void
|
__Garmin.DeviceControl.readFromDevice()
Asynchronously reads data from the connected device. |
void
|
__Garmin.DeviceControl.register(listener)
Register to be an event listener. |
void
|
__Garmin.DeviceControl.setDeviceNumber(deviceNumber)
Sets the deviceNumber variable which determines which connected device to talk to. |
Boolean
|
__Garmin.DeviceControl.unlock(<String> web_path, <String> unlock_code)
Unlocks the GpsControl object to be used at the given web adress. |
void
|
__Garmin.DeviceControl.writeToDevice(<String> xmlString, <String> fileName)
Writes the given xml to the device selected in this.deviceNumber |
void
|
_finishFindDevices()
|
void
|
_finishInteraction(type)
|
void
|
_finishReadFromDevice()
|
void
|
_finishWriteToDevice()
|
void
|
_progressRead()
|
void
|
_progressWrite()
|
void
|
_reportException(exception)
|
void
|
_validatePlugin()
|
void
|
cancelFindDevices()
Cancels the current find devices interaction |
void
|
cancelReadFromDevice()
Cancels the current read from the device |
void
|
cancelWriteToDevice()
Cancels the current write transfer to the device |
void
|
downlaodToDevice(gpiDataString, filename)
Writes GPI info to the device selected in this.deviceNumber. |
void
|
findDevices()
Finds any connected Garmin Devices. |
Array
|
getDevices()
Get a list of the devices found |
Garmin.TransferProgress
|
getDeviceStatus()
Get the status/progress of the current state or transfer |
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 |
Object
|
initialize()
Instantiates a Garmin.DeviceControl object |
Boolean
|
isBrowserSupported()
Determines if the users browser is currently supported by the 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 agent is the current version. |
void
|
readFromDevice()
Asynchronously reads data from the connected device. |
void
|
register(listener)
Register to be an event listener. |
void
|
respondToMessageBox(<Number> response)
Responds to a message box on the device. |
void
|
setDeviceNumber(deviceNumber)
Sets the deviceNumber variable which determines which connected device to talk to. |
Object
|
toString()
|
Boolean
|
unlock(<String> web_path, <String> unlock_code)
Unlocks the GpsControl object to be used at the given web adress. |
void
|
writeToDevice(<String> xmlString, <String> fileName)
Writes the given xml to the device selected in this.deviceNumber |
| Constructor Detail |
Garmin.DeviceControl()
| Method Detail |
void __Garmin.DeviceControl.cancelFindDevices()
void __Garmin.DeviceControl.cancelReadFromDevice()
void __Garmin.DeviceControl.cancelWriteToDevice()
void __Garmin.DeviceControl.downlaodToDevice(gpiDataString, filename)
xmlString - to be written to the device. This doesn't check validity
fileName - to write it to. Validity is not checked here
void __Garmin.DeviceControl.findDevices()
Array__Garmin.DeviceControl.getDevices()
Garmin.TransferProgress __Garmin.DeviceControl.getDeviceStatus()
Array __Garmin.DeviceControl.getPluginVersion()
String __Garmin.DeviceControl.getPluginVersionString()
Object __Garmin.DeviceControl.initialize()
Boolean __Garmin.DeviceControl.isBrowserSupported()
Boolean __Garmin.DeviceControl.isPluginInitialized()
Boolean __Garmin.DeviceControl.isPluginInstalled()
Boolean __Garmin.DeviceControl.isPluginOutOfDate()
void __Garmin.DeviceControl.readFromDevice()
void __Garmin.DeviceControl.register(listener)
Object - that will listen for events coming from this object
void __Garmin.DeviceControl.setDeviceNumber(deviceNumber)
Boolean __Garmin.DeviceControl.unlock(<String> web_path, <String> unlock_code)
web_path -
unlock_code -
void __Garmin.DeviceControl.writeToDevice(<String> xmlString, <String> fileName)
xmlString - to be written to the device. This doesn't check validity
fileName - to write it to. Validity is not checked here
void _finishFindDevices()
void _finishInteraction(type)
type - determines if we are ReadFrom or WriteTo the device
void _finishReadFromDevice()
void _finishWriteToDevice()
void _progressRead()
void _progressWrite()
void _reportException(exception)
void _validatePlugin()
void cancelFindDevices()
void cancelReadFromDevice()
void cancelWriteToDevice()
void downlaodToDevice(gpiDataString, filename)
xmlString - to be written to the device. This doesn't check validity
fileName - to write it to. Validity is not checked here
void findDevices()
ArraygetDevices()
Garmin.TransferProgress getDeviceStatus()
Array getPluginVersion()
String getPluginVersionString()
Object initialize()
Boolean isBrowserSupported()
Boolean isPluginInitialized()
Boolean isPluginInstalled()
Boolean isPluginOutOfDate()
void readFromDevice()
void register(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(deviceNumber)
Object toString()
Boolean unlock(<String> web_path, <String> unlock_code)
web_path -
unlock_code -
void writeToDevice(<String> xmlString, <String> fileName)
xmlString - to be written to the device. This doesn't check validity
fileName - to write it to. Validity is not checked here
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||