sbMockDeviceFirmwareHandler.cpp
Go to the documentation of this file.
1 /* vim: set sw=2 :miv */
2 /*
3 //
4 // BEGIN SONGBIRD GPL
5 //
6 // This file is part of the Songbird web player.
7 //
8 // Copyright(c) 2005-2010 POTI, Inc.
9 // http://songbirdnest.com
10 //
11 // This file may be licensed under the terms of of the
12 // GNU General Public License Version 2 (the "GPL").
13 //
14 // Software distributed under the License is distributed
15 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
16 // express or implied. See the GPL for the specific language
17 // governing rights and limitations.
18 //
19 // You should have received a copy of the GPL along with this
20 // program. If not, go to http://www.gnu.org/licenses/gpl.html
21 // or write to the Free Software Foundation, Inc.,
22 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 //
24 // END SONGBIRD GPL
25 //
26 */
27 
29 
30 #include <nsIDOMDocument.h>
31 #include <nsIDOMElement.h>
32 #include <nsIDOMNode.h>
33 #include <nsIDOMNodeList.h>
34 #include <nsIInputStream.h>
35 #include <nsIInputStreamPump.h>
36 #include <nsIPrefBranch.h>
37 #include <nsIPrefService.h>
38 #include <nsISupportsUtils.h>
39 #include <nsIVariant.h>
40 #include <nsIWritablePropertyBag2.h>
41 
42 #include <nsAutoLock.h>
43 #include <nsCOMPtr.h>
44 #include <nsComponentManagerUtils.h>
45 #include <nsNetUtil.h>
46 #include <nsServiceManagerUtils.h>
47 #include <nsThreadUtils.h>
48 #include <nsXPCOMCIDInternal.h>
49 
50 #include <sbIDevice.h>
51 #include <sbIDeviceFirmwareUpdate.h>
52 #include <sbIDeviceProperties.h>
53 
54 #include <sbVariantUtils.h>
55 
56 
59  nsIStreamListener)
60 
62  "Songbird Device Firmware Tester - Mock Device Firmware Handler")
63 
64 sbMockDeviceFirmwareHandler::sbMockDeviceFirmwareHandler() : mComplete(0)
65 {
66 }
67 
68 sbMockDeviceFirmwareHandler::~sbMockDeviceFirmwareHandler()
69 {
70 }
71 
72 /*virtual*/ nsresult
74 {
75  nsresult rv;
76  mContractId =
77  NS_LITERAL_STRING("@songbirdnest.com/Songbird/Device/Firmware/Handler/MockDevice;1");
78 
80  do_GetService("@songbirdnest.com/mock-firmware-url-handler;1", &rv);
81  NS_ENSURE_SUCCESS(rv, rv);
82 
83  nsCString resetURL;
84  rv = mHandlerURLService->GetRegisterURL(resetURL);
85  NS_ENSURE_SUCCESS(rv, rv);
86 
87  nsCOMPtr<nsIURI> uri;
88  rv = NS_NewURI(getter_AddRefs(uri), resetURL);
89  NS_ENSURE_SUCCESS(rv, rv);
90 
92 
93  nsCString releaseNotesURL;
94  rv = mHandlerURLService->GetReleaseNotesURL(releaseNotesURL);
95  NS_ENSURE_SUCCESS(rv, rv);
96 
97  rv = NS_NewURI(getter_AddRefs(uri), releaseNotesURL);
98  NS_ENSURE_SUCCESS(rv, rv);
99 
100  uri.swap(mReleaseNotesLocation);
101 
102  return NS_OK;
103 }
104 
105 /*virtual*/ nsresult
107 {
108  *aCurrentFirmwareVersion = 0x01000000;
109  return NS_OK;
110 }
111 
112 /*virtual*/ nsresult
113 sbMockDeviceFirmwareHandler::OnGetCurrentFirmwareReadableVersion(nsAString &aCurrentFirmwareReadableVersion)
114 {
115  aCurrentFirmwareReadableVersion.AssignLiteral("1.0.0.0");
116  return NS_OK;
117 }
118 
119 /*virtual*/ nsresult
121 {
122  if(mDevice) {
123  nsCOMPtr<nsIVariant> needsRecoveryModeVariant;
124  nsresult rv =
125  mDevice->GetPreference(NS_LITERAL_STRING("testing.firmware.needRecoveryMode"),
126  getter_AddRefs(needsRecoveryModeVariant));
127  NS_ENSURE_SUCCESS(rv, rv);
128 
129  PRUint16 dataType = 0;
130  rv = needsRecoveryModeVariant->GetDataType(&dataType);
131  NS_ENSURE_SUCCESS(rv, rv);
132 
133  PRBool needsRecoveryMode = PR_FALSE;
134  if(dataType == nsIDataType::VTYPE_BOOL) {
135  rv = needsRecoveryModeVariant->GetAsBool(&needsRecoveryMode);
136  NS_ENSURE_SUCCESS(rv, rv);
137 
139  }
140  }
141 
142  *aRecoveryMode = mRecoveryMode;
143 
144  return NS_OK;
145 }
146 
147 /*virtual*/ nsresult
149 {
150  aModelNumber.AssignLiteral("MOCKBOBMSC0001");
151  return NS_OK;
152 }
153 
154 /*virtual*/ nsresult
156 {
157  aModelVersion.AssignLiteral("MOCKBOBMSC0001/ZX");
158  return NS_OK;
159 }
160 
161 /*virtual*/ nsresult
163 {
164  aDeviceVendor.AssignLiteral("ACME Inc.");
165  return NS_OK;
166 }
167 
168 /*virtual*/ nsresult
170  PRUint32 aDeviceVendorID,
171  PRUint32 aDeviceProductID,
172  PRBool *_retval)
173 {
174  NS_ENSURE_ARG_POINTER(_retval);
175  *_retval = PR_FALSE;
176 
177  nsCOMPtr<sbIDeviceProperties> properties;
178  nsresult rv = aDevice->GetProperties(getter_AddRefs(properties));
179  NS_ENSURE_SUCCESS(rv, rv);
180 
181  nsString vendorName;
182  rv = properties->GetVendorName(vendorName);
183  NS_ENSURE_SUCCESS(rv, rv);
184 
185  // XXXAus: Other firmware handlers will probably want to be a
186  // little bit more stringent.
187  if(!vendorName.EqualsLiteral("ACME Inc.")) {
188  return NS_OK;
189  }
190 
191  // Yep, supported!
192  *_retval = PR_TRUE;
193 
194  return NS_OK;
195 }
196 
197 /*virtual*/ nsresult
199  sbIDeviceEventListener *aListener,
200  PRBool *_retval)
201 {
202  PRBool canHandleDevice = PR_FALSE;
203 
204  *_retval = PR_FALSE;
205 
206  nsresult rv = OnCanUpdate(aDevice, 0, 0, &canHandleDevice);
207  NS_ENSURE_SUCCESS(rv, rv);
208 
209  if(canHandleDevice) {
210  rv = Unbind();
211  NS_ENSURE_SUCCESS(rv, rv);
212 
213  rv = Bind(aDevice, aListener);
214  NS_ENSURE_SUCCESS(rv, rv);
215 
216  *_retval = PR_TRUE;
217  }
218 
219  return NS_OK;
220 }
221 
222 
223 /*virtual*/ nsresult
225 {
226  return NS_OK;
227 }
228 
229 /*virtual*/ nsresult
231 {
232  nsresult rv;
233  nsCString firmwareURL;
234  rv = mHandlerURLService->GetFirmwareURL(firmwareURL);
235  NS_ENSURE_SUCCESS(rv, rv);
236 
237  rv = SendHttpRequest(NS_LITERAL_CSTRING("GET"), firmwareURL);
238  NS_ENSURE_SUCCESS(rv, rv);
239 
241  NS_ENSURE_SUCCESS(rv, rv);
242 
244  nsnull);
245  NS_ENSURE_SUCCESS(rv, rv);
246 
247  return NS_OK;
248 }
249 
250 /*virtual*/ nsresult
252 {
253  {
254  nsCOMPtr<nsIVariant> shouldFailVariant;
255  nsresult rv =
256  mDevice->GetPreference(NS_LITERAL_STRING("testing.firmware.update.fail"),
257  getter_AddRefs(shouldFailVariant));
258  NS_ENSURE_SUCCESS(rv, rv);
259 
260  PRUint16 dataType = 0;
261  rv = shouldFailVariant->GetDataType(&dataType);
262  NS_ENSURE_SUCCESS(rv, rv);
263 
264  PRBool shouldFail = PR_FALSE;
265  if(dataType == nsIDataType::VTYPE_BOOL) {
266  rv = shouldFailVariant->GetAsBool(&shouldFail);
267  NS_ENSURE_SUCCESS(rv, rv);
268  }
269 
270  if(shouldFail) {
271  rv = CheckForError(NS_ERROR_FAILURE,
273  NS_ENSURE_SUCCESS(rv, rv);
274 
275  return NS_OK;
276  }
277  }
278 
279  nsCOMPtr<nsIFile> firmwareFile;
280  nsresult rv =
281  aFirmwareUpdate->GetFirmwareImageFile(getter_AddRefs(firmwareFile));
282  NS_ENSURE_SUCCESS(rv, rv);
283 
284  nsCOMPtr<nsIInputStream> inputStream;
285  rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), firmwareFile);
286  NS_ENSURE_SUCCESS(rv, rv);
287 
288  nsCOMPtr<nsIInputStreamPump> inputStreamPump;
289  rv = NS_NewInputStreamPump(getter_AddRefs(inputStreamPump),
290  inputStream, -1, -1, 0, 0, PR_TRUE);
291  NS_ENSURE_SUCCESS(rv, rv);
292 
294  NS_ENSURE_SUCCESS(rv, rv);
295 
296  rv = inputStreamPump->AsyncRead(this, firmwareFile);
297  NS_ENSURE_SUCCESS(rv, rv);
298 
299  // Wait on read completion so that the thread doesn't die before the read is
300  // complete.
301  nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
302  while (!PR_AtomicAdd(&mComplete, 0)) {
303  if (!NS_ProcessNextEvent(thread, PR_FALSE)) {
304  PR_Sleep(PR_MillisecondsToInterval(100));
305  }
306  }
307  return NS_OK;
308 }
309 
310 /*virtual*/ nsresult
312 {
313  return OnUpdate(aFirmwareUpdate);
314 }
315 
316 /*virtual*/ nsresult
318 {
337  return NS_ERROR_NOT_IMPLEMENTED;
338 }
339 
340 /*virtual*/ nsresult
342 {
361  return NS_ERROR_NOT_IMPLEMENTED;
362 }
363 
364 /*virtual*/ nsresult
366 {
367  nsresult rv = NS_ERROR_UNEXPECTED;
368  handlerstate_t state = GetState();
369 
370  switch(state) {
373  NS_ENSURE_SUCCESS(rv, rv);
374  }
375  break;
376 
377  default:
378  NS_WARNING("No code!");
379  }
380 
381  return NS_OK;
382 }
383 
384 nsresult
386 {
387  PRUint32 status = 0;
388 
389  // XXXAus: Check device pref to see if we should simulate a failure!
390 
391  nsresult rv = mXMLHttpRequest->GetStatus(&status);
392  NS_ENSURE_SUCCESS(rv, rv);
393 
394  nsCOMPtr<nsIDOMDocument> document;
395  rv = mXMLHttpRequest->GetResponseXML(getter_AddRefs(document));
396  NS_ENSURE_SUCCESS(rv, rv);
397  NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);
398 
399  nsCOMPtr<nsIDOMNodeList> rootNodeList;
400  rv = document->GetElementsByTagName(NS_LITERAL_STRING("firmware"),
401  getter_AddRefs(rootNodeList));
402  NS_ENSURE_SUCCESS(rv, rv);
403 
404  PRUint32 rootNodeListLength = 0;
405  rv = rootNodeList->GetLength(&rootNodeListLength);
406  NS_ENSURE_SUCCESS(rv, rv);
407 
408  // XXXAus: Only one 'firmware' node is allowed.
409  NS_ENSURE_TRUE(rootNodeListLength == 1, NS_ERROR_FAILURE);
410 
411  nsCOMPtr<nsIDOMNode> rootNode;
412  rv = rootNodeList->Item(0, getter_AddRefs(rootNode));
413  NS_ENSURE_SUCCESS(rv, rv);
414 
415  nsCOMPtr<nsIDOMNodeList> childNodes;
416  rv = rootNode->GetChildNodes(getter_AddRefs(childNodes));
417  NS_ENSURE_SUCCESS(rv, rv);
418 
419  PRUint32 childNodeListLength = 0;
420  rv = childNodes->GetLength(&childNodeListLength);
421  NS_ENSURE_SUCCESS(rv, rv);
422 
423  for(PRUint32 i = 0; i < childNodeListLength; ++i) {
424  nsCOMPtr<nsIDOMNode> domNode;
425  rv = childNodes->Item(i, getter_AddRefs(domNode));
426  NS_ENSURE_SUCCESS(rv, rv);
427 
428  nsCOMPtr<nsIDOMElement> element = do_QueryInterface(domNode, &rv);
429  if(NS_FAILED(rv)) {
430  continue;
431  }
432 
433  nsString tagName;
434  rv = element->GetTagName(tagName);
435  NS_ENSURE_SUCCESS(rv, rv);
436 
437  nsString value;
438  rv = element->GetAttribute(NS_LITERAL_STRING("value"), value);
439  if(NS_FAILED(rv)) {
440  continue;
441  }
442 
443  // XXXAus: We only support 'version' and 'location' nodes
444  // and they must have a 'value' attribute.
445  if(tagName.EqualsLiteral("version")) {
446  nsAutoMonitor mon(mMonitor);
448  mFirmwareVersion = 0x01000001;
449  }
450  else if(tagName.EqualsLiteral("location")) {
451  nsCOMPtr<nsIURI> uri;
452  rv = CreateProxiedURI(NS_ConvertUTF16toUTF8(value),
453  getter_AddRefs(uri));
454  NS_ENSURE_SUCCESS(rv, rv);
455 
456  nsAutoMonitor mon(mMonitor);
458  }
459  }
460 
461  {
462  nsCString supportURL;
463  rv = mHandlerURLService->GetSupportURL(supportURL);
464  NS_ENSURE_SUCCESS(rv, rv);
465 
466  nsCOMPtr<nsIURI> uri;
467  nsresult rv = NS_NewURI(getter_AddRefs(uri), supportURL);
468  NS_ENSURE_SUCCESS(rv, rv);
469 
470  nsAutoMonitor mon(mMonitor);
471  uri.swap(mSupportLocation);
472  mon.Exit();
473 
474  nsCString registerURL;
475  rv = mHandlerURLService->GetRegisterURL(registerURL);
476  NS_ENSURE_SUCCESS(rv, rv);
477 
478  rv = NS_NewURI(getter_AddRefs(uri), registerURL);
479  NS_ENSURE_SUCCESS(rv, rv);
480 
481  mon.Enter();
482  uri.swap(mRegisterLocation);
483  mon.Exit();
484 
485  nsCString resetURL;
486  rv = mHandlerURLService->GetRegisterURL(resetURL);
487  NS_ENSURE_SUCCESS(rv, rv);
488 
489  rv = NS_NewURI(getter_AddRefs(uri), resetURL);
490  NS_ENSURE_SUCCESS(rv, rv);
491 
492  mon.Enter();
493  uri.swap(mResetInstructionsLocation);
494  mon.Exit();
495 
496  if(mDevice) {
497  nsCOMPtr<nsIVariant> needsRecoveryModeVariant;
498  rv = mDevice->GetPreference(NS_LITERAL_STRING("testing.firmware.needRecoveryMode"),
499  getter_AddRefs(needsRecoveryModeVariant));
500  NS_ENSURE_SUCCESS(rv, rv);
501 
502  PRUint16 dataType = 0;
503  rv = needsRecoveryModeVariant->GetDataType(&dataType);
504  NS_ENSURE_SUCCESS(rv, rv);
505 
506  PRBool needsRecoveryMode = PR_FALSE;
507  if(dataType == nsIDataType::VTYPE_BOOL) {
508  rv = needsRecoveryModeVariant->GetAsBool(&needsRecoveryMode);
509  NS_ENSURE_SUCCESS(rv, rv);
510 
511  mon.Enter();
513  mon.Exit();
514  }
515  }
516  }
517 
518  if(mDevice) {
519  nsCOMPtr<nsIVariant> shouldFailVariant;
520  rv = mDevice->GetPreference(NS_LITERAL_STRING("testing.firmware.cfu.fail"),
521  getter_AddRefs(shouldFailVariant));
522  NS_ENSURE_SUCCESS(rv, rv);
523 
524  PRUint16 dataType = 0;
525  rv = shouldFailVariant->GetDataType(&dataType);
526  NS_ENSURE_SUCCESS(rv, rv);
527 
528  PRBool shouldFail = PR_FALSE;
529  if(dataType == nsIDataType::VTYPE_BOOL) {
530  rv = shouldFailVariant->GetAsBool(&shouldFail);
531  NS_ENSURE_SUCCESS(rv, rv);
532  }
533 
534  if(shouldFail) {
535  rv = CheckForError(NS_ERROR_FAILURE,
537  NS_ENSURE_SUCCESS(rv, rv);
538 
539  return NS_ERROR_FAILURE;
540  }
541  }
542 
543  // XXXAus: Looks like we have an update location and version.
544  // Figure out if we should say there is an update available
545  // or not by comparing current device firmware version
546  // and the one we got from the web service.
547 
548  // XXXAus: For now just pretend like it's always new.
549  nsCOMPtr<nsIVariant> data =
550  sbNewVariant(PR_TRUE, nsIDataType::VTYPE_BOOL).get();
551 
553  data);
554  NS_ENSURE_SUCCESS(rv, rv);
555 
556  return NS_OK;
557 }
558 
559 // -----------------------------------------------------------------------------
560 // nsIStreamListener
561 // -----------------------------------------------------------------------------
562 NS_IMETHODIMP
563 sbMockDeviceFirmwareHandler::OnStartRequest(nsIRequest *aRequest,
564  nsISupports *aContext)
565 {
566  nsresult rv =
568  NS_ENSURE_SUCCESS(rv, rv);
569 
570  return NS_OK;
571 }
572 
573 NS_IMETHODIMP
574 sbMockDeviceFirmwareHandler::OnDataAvailable(nsIRequest *aRequest,
575  nsISupports *aContext,
576  nsIInputStream *aStream,
577  PRUint32 aOffset,
578  PRUint32 aCount)
579 {
580  nsresult rv = NS_ERROR_UNEXPECTED;
581  nsCOMPtr<nsIFile> firmwareFile = do_QueryInterface(aContext, &rv);
582  NS_ENSURE_SUCCESS(rv, rv);
583 
584  PRUint32 availableBytes = 0;
585  rv = aStream->Available(&availableBytes);
586  NS_ENSURE_SUCCESS(rv, rv);
587 
588  char *buffer =
589  reinterpret_cast<char *>(NS_Alloc(availableBytes * sizeof(char)));
590  NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
591 
592  PRUint32 readBytes = 0;
593  rv = aStream->Read(buffer, availableBytes, &readBytes);
594 
595  NS_Free(buffer);
596  NS_ENSURE_SUCCESS(rv, rv);
597 
598  PRInt64 fileSize = 0;
599  rv = firmwareFile->GetFileSize(&fileSize);
600  NS_ENSURE_SUCCESS(rv, rv);
601 
602  PRUint32 progress = static_cast<PRUint32>(aOffset * 100 / fileSize);
603 
604  nsCOMPtr<nsIVariant> progressVariant = sbNewVariant(progress).get();
606  NS_ENSURE_SUCCESS(rv, rv);
607 
608  PR_Sleep(PR_MillisecondsToInterval(50));
609 
610  {
611  nsCOMPtr<nsIVariant> shouldFailVariant;
612  nsresult rv =
613  mDevice->GetPreference(NS_LITERAL_STRING("testing.firmware.write.fail"),
614  getter_AddRefs(shouldFailVariant));
615  NS_ENSURE_SUCCESS(rv, rv);
616 
617  PRUint16 dataType = 0;
618  rv = shouldFailVariant->GetDataType(&dataType);
619  NS_ENSURE_SUCCESS(rv, rv);
620 
621  PRBool shouldFail = PR_FALSE;
622  if(dataType == nsIDataType::VTYPE_BOOL) {
623  rv = shouldFailVariant->GetAsBool(&shouldFail);
624  NS_ENSURE_SUCCESS(rv, rv);
625  }
626 
627  if(shouldFail) {
628  rv = CheckForError(NS_ERROR_FAILURE,
630  NS_ENSURE_SUCCESS(rv, rv);
631 
632  return NS_ERROR_FAILURE;
633  }
634  }
635 
636  return NS_OK;
637 }
638 
639 NS_IMETHODIMP
640 sbMockDeviceFirmwareHandler::OnStopRequest(nsIRequest *aRequest,
641  nsISupports *aContext,
642  nsresult aResultCode)
643 {
644  nsresult rv =
646  NS_ENSURE_SUCCESS(rv, rv);
647 
649  NS_ENSURE_SUCCESS(rv, rv);
650 
652  NS_ENSURE_SUCCESS(rv, rv);
653 
654  PR_AtomicIncrement(&mComplete);
655 
656  return NS_OK;
657 }
function readBytes(inputStream, count)
Definition: httpd.js:1148
virtual nsresult OnGetCurrentFirmwareVersion(PRUint32 *aCurrentFirmwareVersion)
return NS_OK
readonly attribute boolean needsRecoveryMode
Whether the device needs to be in recovery mode to have its firmware updated.
virtual nsresult OnGetDeviceModelNumber(nsAString &aModelNumber)
nsIVariant * get() const
const unsigned long EVENT_FIRMWARE_WRITE_END
Firmware write to device start.
const unsigned long EVENT_FIRMWARE_CFU_END
Check for update end.
Songbird Variant Utility Definitions.
nsresult SetState(handlerstate_t aState)
Get internal state.
nsresult CheckForError(const nsresult &aResult, PRUint32 aEventType, nsIVariant *aData=nsnull)
Check nsresult value, send error event if nsresult value is an error.
const unsigned long EVENT_FIRMWARE_UPDATE_END
Firmware update end.
const unsigned long EVENT_FIRMWARE_WRITE_START
Firmware write to device start.
virtual nsresult OnRecover(sbIDeviceFirmwareUpdate *aFirmwareUpdate)
virtual nsresult OnRebind(sbIDevice *aDevice, sbIDeviceEventListener *aListener, PRBool *_retval)
handlerstate_t GetState()
Set internal state.
const unsigned long EVENT_FIRMWARE_CFU_START
Check for update start.
nsresult SendDeviceEvent(sbIDeviceEvent *aEvent, PRBool aAsync=PR_TRUE)
Send a device event.
const unsigned long EVENT_FIRMWARE_CFU_ERROR
Check for update error.
virtual nsresult OnCanUpdate(sbIDevice *aDevice, PRUint32 aDeviceVendorID, PRUint32 aDeviceProductID, PRBool *_retval)
const unsigned long EVENT_FIRMWARE_WRITE_PROGRESS
Firmware write to device start.
nsCOMPtr< sbPIMockFirmwareHandlerURLService > mHandlerURLService
const unsigned long EVENT_FIRMWARE_UPDATE_ERROR
Firmware update error.
nsCOMPtr< nsIXMLHttpRequest > mXMLHttpRequest
virtual nsresult OnVerifyUpdate(sbIDeviceFirmwareUpdate *aFirmwareUpdate)
#define SB_DEVICE_FIRMWARE_HANLDER_REGISTERSELF_IMPL(_name, _desc)
NS_IMPL_ISUPPORTS_INHERITED1(sbMockDeviceFirmwareHandler, sbBaseDeviceFirmwareHandler, nsIStreamListener) SB_DEVICE_FIRMWARE_HANLDER_REGISTERSELF_IMPL(sbMockDeviceFirmwareHandler
var uri
Definition: FeedWriter.js:1135
countRef value
Definition: FeedWriter.js:1423
virtual nsresult OnGetRecoveryMode(PRBool *aRecoveryMode)
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...
virtual nsresult OnGetDeviceModelVersion(nsAString &aModelVersion)
restoreHistoryPrecursor aCount
observe data
Definition: FeedWriter.js:1329
_getSelectedPageStyle s i
virtual nsresult OnGetDeviceVendor(nsAString &aDeviceVendor)
virtual nsresult OnGetCurrentFirmwareReadableVersion(nsAString &aCurrentFirmwareReadableVersion)
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.
const unsigned long EVENT_FIRMWARE_UPDATE_START
Firmware update start.
const unsigned long EVENT_FIRMWARE_WRITE_ERROR
Firmware write error.
virtual nsresult OnUpdate(sbIDeviceFirmwareUpdate *aFirmwareUpdate)