Class Garmin.DeviceControl

Object
   |
   +--Garmin.DeviceControl

class 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 (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

Requires:


Constructor Summary
Garmin.DeviceControl()
            A controller object that can retrieve and send data to a Garmin device.

 
Method Summary
 void _finishInteraction(type)
           Generic internal lifecycle handling.
 Object _majorVersionToNumber(versionArray)
          
 Object _versionToNumber(versionArray)
          
 void cancelFindDevices()
           Cancels the current find devices interaction
 void cancelReadFromDevice()
           Cancels the urrent 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
 void initialize()
           Instantiates a Garmin.DeviceControl object, but does not unlock/activate plugin.
 Boolean isActivated()
           True if plugin has been successfully created and unlocked.
 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 readFromDeviceFitness()
           Asynchronously reads fotmess 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.
 String toString()
           String representation of instance.
 Boolean unlock(<Array> pathKeyPairsArray)
           Unlocks the GpsControl object to be used at the given web adress.
 void writeAddressToDevice(<String> address)
           Writes an address to the currently selected device.
 void writeToDevice(<String> xmlString, <String> fileName)
           Writes the given xml to the device selected in this.deviceNumber

Constructor Detail

Garmin.DeviceControl

Garmin.DeviceControl()

Method Detail

_finishInteraction

void _finishInteraction(type)

_majorVersionToNumber

Object _majorVersionToNumber(versionArray)

_versionToNumber

Object _versionToNumber(versionArray)

cancelFindDevices

void cancelFindDevices()

cancelReadFromDevice

void cancelReadFromDevice()

cancelWriteToDevice

void cancelWriteToDevice()

downlaodToDevice

void downlaodToDevice(gpiDataString, filename)

findDevices

void findDevices()

getDevices

Array getDevices()

getDeviceStatus

Garmin.TransferProgress getDeviceStatus()

getPluginVersion

Array getPluginVersion()

getPluginVersionString

String getPluginVersionString()

initialize

void initialize()

isActivated

Boolean isActivated()

isPluginInitialized

Boolean isPluginInitialized()

isPluginInstalled

Boolean isPluginInstalled()

isPluginOutOfDate

Boolean isPluginOutOfDate()

readFromDevice

void readFromDevice()

readFromDeviceFitness

void readFromDeviceFitness()

register

void register(listener)

respondToMessageBox

void respondToMessageBox(<Number> response)

setDeviceNumber

void setDeviceNumber(deviceNumber)

toString

String toString()

unlock

Boolean unlock(<Array> pathKeyPairsArray)

writeAddressToDevice

void writeAddressToDevice(<String> address)

writeToDevice

void writeToDevice(<String> xmlString, <String> fileName)


Documentation generated by JSDoc on Tue May 29 09:15:02 2007