sbMockDeviceFirmwareHandler Class Reference

#include <sbMockDeviceFirmwareHandler.h>

Inheritance diagram for sbMockDeviceFirmwareHandler:
[legend]
Collaboration diagram for sbMockDeviceFirmwareHandler:
[legend]

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSIREQUESTOBSERVER 
sbMockDeviceFirmwareHandler ()
 
virtual nsresult OnInit ()
 
virtual nsresult OnGetCurrentFirmwareVersion (PRUint32 *aCurrentFirmwareVersion)
 
virtual nsresult OnGetCurrentFirmwareReadableVersion (nsAString &aCurrentFirmwareReadableVersion)
 
virtual nsresult OnGetRecoveryMode (PRBool *aRecoveryMode)
 
virtual nsresult OnGetDeviceModelNumber (nsAString &aModelNumber)
 
virtual nsresult OnGetDeviceModelVersion (nsAString &aModelVersion)
 
virtual nsresult OnGetDeviceVendor (nsAString &aDeviceVendor)
 
virtual nsresult OnCanUpdate (sbIDevice *aDevice, PRUint32 aDeviceVendorID, PRUint32 aDeviceProductID, PRBool *_retval)
 
virtual nsresult OnRebind (sbIDevice *aDevice, sbIDeviceEventListener *aListener, PRBool *_retval)
 
virtual nsresult OnCancel ()
 
virtual nsresult OnRefreshInfo ()
 
virtual nsresult OnUpdate (sbIDeviceFirmwareUpdate *aFirmwareUpdate)
 
virtual nsresult OnRecover (sbIDeviceFirmwareUpdate *aFirmwareUpdate)
 
virtual nsresult OnVerifyDevice ()
 
virtual nsresult OnVerifyUpdate (sbIDeviceFirmwareUpdate *aFirmwareUpdate)
 
virtual nsresult OnHttpRequestCompleted ()
 
- Public Member Functions inherited from sbBaseDeviceFirmwareHandler
 sbBaseDeviceFirmwareHandler ()
 
nsresult Init ()
 
nsresult AppendSupportedDevice (const nsAString &aDeviceFriendlyName, const PRUint32 aDeviceVendorID, const PRUint32 aDeviceProductID)
 Append an entry to the list of supported devices. More...
 
nsresult AppendSupportedDeviceProductID (const nsAString &aDeviceFriendlyName, const PRUint32 aDeviceProductID)
 
nsresult CreateProxiedURI (const nsACString &aURISpec, nsIURI **aURI)
 Create an nsIURI from a spec string (e.g. http://some.url.com/path) in a thread-safe manner. More...
 
nsresult SendHttpRequest (const nsACString &aMethod, const nsACString &aUrl, const nsAString &aUsername=EmptyString(), const nsAString &aPassword=EmptyString(), const nsACString &aContentType=EmptyCString(), nsIVariant *aRequestBody=nsnull)
 Send an HTTP request. More...
 
nsresult AbortHttpRequest ()
 Abort an HTTP request. More...
 
nsresult CreateDeviceEvent (PRUint32 aType, nsIVariant *aData, sbIDeviceEvent **aEvent)
 Create a device event. More...
 
nsresult SendDeviceEvent (sbIDeviceEvent *aEvent, PRBool aAsync=PR_TRUE)
 Send a device event. More...
 
nsresult SendDeviceEvent (PRUint32 aType, nsIVariant *aData, PRBool aAsync=PR_TRUE)
 Send a device event. More...
 
handlerstate_t GetState ()
 Set internal state. More...
 
nsresult SetState (handlerstate_t aState)
 Get internal state. More...
 
nsresult CheckForError (const nsresult &aResult, PRUint32 aEventType, nsIVariant *aData=nsnull)
 Check nsresult value, send error event if nsresult value is an error. More...
 
virtual nsresult OnGetSupportedDevices (nsISimpleEnumerator **aSupportedDevices)
 
virtual nsresult OnBeginRecoveryModeSwitch (PRUint32 aDeviceVendorID, PRUint32 aDeviceProductID)
 
virtual nsresult OnEndRecoveryModeSwitch ()
 
- Public Member Functions inherited from sbIDeviceFirmwareHandler
boolean canUpdate (in sbIDevice aDevice, in unsigned long aDeviceVendorID, in unsigned long aDeviceProductID)
 Check to see if this handler can update the specified device. More...
 
void initiateRecoveryModeSwitch ([optional] in unsigned long aDeviceVendorID, [optional] in unsigned long aDeviceProductID)
 Notify the handler to expect a device to connect in recovery mode. More...
 
void bind (in sbIDevice aDevice, in sbIDeviceEventListener aListener)
 Bind the handler to a device. More...
 
boolean rebind (in sbIDevice aDevice, in sbIDeviceEventListener aListener)
 Rebind a device to an already running handler. More...
 
void unbind ()
 Unbind the handler. More...
 
void cancel ()
 Cancel the current operation. More...
 
void refreshInfo ()
 Refresh the firmware location, version, readable version, notes, and instructions. More...
 
void update (in sbIDeviceFirmwareUpdate aFirmwareUpdate)
 Perform a firmware update on the specified device. More...
 
void recover (in sbIDeviceFirmwareUpdate aFirmwareUpdate)
 Perform a recovery update on the specified device. More...
 
void verifyDevice ()
 Verify the firmware already on the device. More...
 
void verifyUpdate (in sbIDeviceFirmwareUpdate aFirmwareUpdate)
 Verify the firmware update image. More...
 

Protected Member Functions

nsresult HandleRefreshInfoRequest ()
 
- Protected Member Functions inherited from sbBaseDeviceFirmwareHandler
virtual ~sbBaseDeviceFirmwareHandler ()
 

Protected Attributes

nsCOMPtr
< sbPIMockFirmwareHandlerURLService
mHandlerURLService
 
PRInt32 mComplete
 
- Protected Attributes inherited from sbBaseDeviceFirmwareHandler
PRMonitor * mMonitor
 
nsCOMPtr< sbIDevicemDevice
 
nsCOMPtr< sbIDeviceEventListenermListener
 
nsCOMPtr< sbIDeviceEventListenermProxiedListener
 
handlerstate_t mHandlerState
 
PRUint32 mFirmwareVersion
 
PRUint32 mDefaultFirmwareVersion
 
nsString mContractId
 
nsString mReadableFirmwareVersion
 
nsString mDefaultReadableFirmwareVersion
 
nsCOMPtr< nsIURI > mDefaultFirmwareLocation
 
nsCOMPtr< nsIURI > mFirmwareLocation
 
nsCOMPtr< nsIURI > mDefaultReleaseNotesLocation
 
nsCOMPtr< nsIURI > mReleaseNotesLocation
 
nsCOMPtr< nsIURI > mResetInstructionsLocation
 
nsString mRecoveryModeKeyCombination
 
nsCOMPtr< nsIURI > mSupportLocation
 
nsCOMPtr< nsIURI > mRegisterLocation
 
PRPackedBool mNeedsRecoveryMode
 
PRPackedBool mRecoveryMode
 
nsCOMPtr< nsIXMLHttpRequest > mXMLHttpRequest
 
nsCOMPtr< nsITimer > mXMLHttpRequestTimer
 
nsCOMPtr< nsIMutableArray > mSupportedDevices
 

Additional Inherited Members

- Public Types inherited from sbBaseDeviceFirmwareHandler
enum  handlerstate_t { HANDLER_IDLE = 0, HANDLER_REFRESHING_INFO, HANDLER_UPDATING_DEVICE, HANDLER_X }
 
- Public Attributes inherited from sbIDeviceFirmwareHandler
readonly attribute AString contractId
 The Contract ID for this handler. More...
 
readonly attribute nsIURI latestFirmwareLocation
 URI for latest firmware (where it can be downloaded from). More...
 
readonly attribute unsigned long latestFirmwareVersion
 The latest firmware version, in machine friendly format. More...
 
readonly attribute AString latestFirmwareReadableVersion
 The latest firmware version, in human readable format. More...
 
readonly attribute unsigned long currentFirmwareVersion
 The current firmware version, in machine friendly format. More...
 
readonly attribute AString currentFirmwareReadableVersion
 The current firmware version on the device, in human readable format (eg. xx.xx.xx.xx). More...
 
readonly attribute nsIURI releaseNotesLocation
 Location for the release notes of the latest firmware. More...
 
readonly attribute nsIURI resetInstructionsLocation
 Location of the reset instructions. More...
 
readonly attribute AString recoveryModeKeyCombination
 Magic key combination required by the device to go into recovery or firmware flashing mode. More...
 
readonly attribute nsIURI customerSupportLocation
 Device Customer Support URL. More...
 
readonly attribute nsIURI registerLocation
 Location where one can perform owner registration with the device manufacturer. More...
 
readonly attribute boolean needsRecoveryMode
 Whether the device needs to be in recovery mode to have its firmware updated. More...
 
readonly attribute boolean recoveryMode
 Indicates whether the device is in recovery mode or not. More...
 
readonly attribute
sbIDeviceFirmwareUpdate 
defaultFirmwareUpdate
 The default firmware update that is packaged with the firmware handler. This update should always be available. More...
 
readonly attribute sbIDevice boundDevice
 The device bound to this handler, or null. More...
 
readonly attribute AString deviceModelNumber
 Device model number / name as reported by the firmware handler. More...
 
readonly attribute AString deviceModelVersion
 Device model version / version name as reported by the firmware handler. More...
 
readonly attribute AString deviceVendor
 Device manufacturer as reported by the firmware handler. More...
 
readonly attribute
nsISimpleEnumerator 
supportedDevices
 Array containing the list of devices supported by the firmware handler. More...
 

Detailed Description

Definition at line 36 of file sbMockDeviceFirmwareHandler.h.

Constructor & Destructor Documentation

Songbird Device Firmware Tester Mock Device Firmware Handler sbMockDeviceFirmwareHandler::sbMockDeviceFirmwareHandler ( )

Definition at line 64 of file sbMockDeviceFirmwareHandler.cpp.

Member Function Documentation

nsresult sbMockDeviceFirmwareHandler::HandleRefreshInfoRequest ( )
protected

Definition at line 385 of file sbMockDeviceFirmwareHandler.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult sbMockDeviceFirmwareHandler::OnCancel ( )
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 224 of file sbMockDeviceFirmwareHandler.cpp.

nsresult sbMockDeviceFirmwareHandler::OnCanUpdate ( sbIDevice aDevice,
PRUint32  aDeviceVendorID,
PRUint32  aDeviceProductID,
PRBool *  _retval 
)
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 169 of file sbMockDeviceFirmwareHandler.cpp.

Here is the caller graph for this function:

nsresult sbMockDeviceFirmwareHandler::OnGetCurrentFirmwareReadableVersion ( nsAString &  aCurrentFirmwareReadableVersion)
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 113 of file sbMockDeviceFirmwareHandler.cpp.

nsresult sbMockDeviceFirmwareHandler::OnGetCurrentFirmwareVersion ( PRUint32 *  aCurrentFirmwareVersion)
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 106 of file sbMockDeviceFirmwareHandler.cpp.

nsresult sbMockDeviceFirmwareHandler::OnGetDeviceModelNumber ( nsAString &  aModelNumber)
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 148 of file sbMockDeviceFirmwareHandler.cpp.

nsresult sbMockDeviceFirmwareHandler::OnGetDeviceModelVersion ( nsAString &  aModelVersion)
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 155 of file sbMockDeviceFirmwareHandler.cpp.

nsresult sbMockDeviceFirmwareHandler::OnGetDeviceVendor ( nsAString &  aDeviceVendor)
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 162 of file sbMockDeviceFirmwareHandler.cpp.

nsresult sbMockDeviceFirmwareHandler::OnGetRecoveryMode ( PRBool *  aRecoveryMode)
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 120 of file sbMockDeviceFirmwareHandler.cpp.

nsresult sbMockDeviceFirmwareHandler::OnHttpRequestCompleted ( )
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 365 of file sbMockDeviceFirmwareHandler.cpp.

Here is the call graph for this function:

nsresult sbMockDeviceFirmwareHandler::OnInit ( )
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 73 of file sbMockDeviceFirmwareHandler.cpp.

nsresult sbMockDeviceFirmwareHandler::OnRebind ( sbIDevice aDevice,
sbIDeviceEventListener aListener,
PRBool *  _retval 
)
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 198 of file sbMockDeviceFirmwareHandler.cpp.

Here is the call graph for this function:

nsresult sbMockDeviceFirmwareHandler::OnRecover ( sbIDeviceFirmwareUpdate aFirmwareUpdate)
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 311 of file sbMockDeviceFirmwareHandler.cpp.

Here is the call graph for this function:

nsresult sbMockDeviceFirmwareHandler::OnRefreshInfo ( )
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 230 of file sbMockDeviceFirmwareHandler.cpp.

Here is the call graph for this function:

nsresult sbMockDeviceFirmwareHandler::OnUpdate ( sbIDeviceFirmwareUpdate aFirmwareUpdate)
virtual

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 251 of file sbMockDeviceFirmwareHandler.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult sbMockDeviceFirmwareHandler::OnVerifyDevice ( )
virtual

Here is where you will want to verify the firmware on the device itself to ensure that it is not corrupt. Whichever method you use will most likely be device specific.

The implementation of this method must be asynchronous and not block the main thread. The flow of expected events is as follows: firmware verify start, firmware verify progress, firmware verify end.

If any firmware verify error events are sent during the process the firmware is considered corrupted.

See sbIDeviceEvent for more infomation about event payload.

Events must be sent to both the device and the listener (if it is specified during the call).

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 317 of file sbMockDeviceFirmwareHandler.cpp.

nsresult sbMockDeviceFirmwareHandler::OnVerifyUpdate ( sbIDeviceFirmwareUpdate aFirmwareUpdate)
virtual

Here is where you should provide a way to verify the firmware update image itself to make sure that it is not corrupt in any way.

The implementation of this method must be asynchronous and not block the main thread. The flow of expected events is as follows: firmware image verify start, firmware image verify progress, firmware image verify end.

If any firmware image verify error events are sent during the process the firmware image is considered corrupted.

See sbIDeviceEvent for more infomation about event payload.

Events must be sent to both the device and the listener (if it is specified during the call).

Reimplemented from sbBaseDeviceFirmwareHandler.

Definition at line 341 of file sbMockDeviceFirmwareHandler.cpp.

Member Data Documentation

PRInt32 sbMockDeviceFirmwareHandler::mComplete
protected

Definition at line 76 of file sbMockDeviceFirmwareHandler.h.

nsCOMPtr<sbPIMockFirmwareHandlerURLService> sbMockDeviceFirmwareHandler::mHandlerURLService
protected

Definition at line 75 of file sbMockDeviceFirmwareHandler.h.


The documentation for this class was generated from the following files: