sbIDeviceFirmwareHandler.idl
Go to the documentation of this file.
1 /*
2  *=BEGIN SONGBIRD GPL
3  *
4  * This file is part of the Songbird web player.
5  *
6  * Copyright(c) 2005-2010 POTI, Inc.
7  * http://www.songbirdnest.com
8  *
9  * This file may be licensed under the terms of of the
10  * GNU General Public License Version 2 (the ``GPL'').
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the GPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the GPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/gpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  *=END SONGBIRD GPL
23  */
24 
25 #include "nsISupports.idl"
26 
27 interface nsISimpleEnumerator;
28 interface nsIURI;
29 interface sbIDevice;
30 interface sbIDeviceEventListener;
31 interface sbIDeviceFirmwareUpdate;
32 
41 [scriptable, uuid(caf2294b-da39-48ac-859a-6ebfd4433eeb)]
43 {
47  readonly attribute AString contractId;
48 
54  readonly attribute nsIURI latestFirmwareLocation;
55 
61  readonly attribute unsigned long latestFirmwareVersion;
62 
68  readonly attribute AString latestFirmwareReadableVersion;
69 
75  readonly attribute unsigned long currentFirmwareVersion;
82  readonly attribute AString currentFirmwareReadableVersion;
83 
89  readonly attribute nsIURI releaseNotesLocation;
90 
97  readonly attribute nsIURI resetInstructionsLocation;
98 
106  readonly attribute AString recoveryModeKeyCombination;
107 
113  readonly attribute nsIURI customerSupportLocation;
114 
121  readonly attribute nsIURI registerLocation;
122 
129  readonly attribute boolean needsRecoveryMode;
130 
136  readonly attribute boolean recoveryMode;
137 
143 
147  readonly attribute sbIDevice boundDevice;
148 
153  readonly attribute AString deviceModelNumber;
154 
160  readonly attribute AString deviceModelVersion;
161 
166  readonly attribute AString deviceVendor;
167 
175 
186  boolean canUpdate(in sbIDevice aDevice,
187  in unsigned long aDeviceVendorID,
188  in unsigned long aDeviceProductID);
189 
203  [optional] in unsigned long aDeviceVendorID,
204  [optional] in unsigned long aDeviceProductID);
205 
215  void bind(in sbIDevice aDevice, in sbIDeviceEventListener aListener);
216 
228  boolean rebind(in sbIDevice aDevice, in sbIDeviceEventListener aListener);
229 
233  void unbind();
234 
238  void cancel();
239 
244  void refreshInfo();
245 
250  void update(in sbIDeviceFirmwareUpdate aFirmwareUpdate);
251 
258  void recover(in sbIDeviceFirmwareUpdate aFirmwareUpdate);
259 
263  void verifyDevice();
264 
269  void verifyUpdate(in sbIDeviceFirmwareUpdate aFirmwareUpdate);
270 };
271 
272 %{C++
273 
274 #include <nsIComponentManager.h>
275 #include <nsICategoryManager.h>
276 #include <nsIGenericFactory.h>
277 #include <nsIServiceManager.h>
278 
279 #include <nsCOMPtr.h>
280 #include <nsServiceManagerUtils.h>
281 #include <nsStringGlue.h>
282 #include <nsXPCOMCID.h>
283 
284 class nsIFile;
285 struct nsModuleComponentInfo;
286 
287 #define SB_DEVICE_FIRMWARE_HANDLER_CATEGORY "songbird-device-firmware-handler"
288 
310 #define SB_DEVICE_FIRMWARE_HANDLER_REGISTERSELF(_name) \
311  \
312  NS_METHOD _name##RegisterSelf(nsIComponentManager* aCompMgr, \
313  nsIFile* aPath, \
314  const char* registryLocation, \
315  const char* componentType, \
316  const nsModuleComponentInfo* info); \
317  \
318  NS_METHOD _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
319  nsIFile* aPath, \
320  const char* registryLocation, \
321  const nsModuleComponentInfo* info)
322 
326 #define SB_DEVICE_FIRMWARE_HANLDER_REGISTERSELF_IMPL(_name, _desc) \
327  \
328  NS_METHOD \
329  _name##RegisterSelf(nsIComponentManager* aCompMgr, \
330  nsIFile* aPath, \
331  const char* registryLocation, \
332  const char* componentType, \
333  const nsModuleComponentInfo* info) \
334  { \
335  nsresult rv; \
336  nsCOMPtr<nsICategoryManager> catMan = \
337  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
338  NS_ENSURE_SUCCESS(rv, rv); \
339  nsCAutoString prevEntry; \
340  rv = catMan->AddCategoryEntry(SB_DEVICE_FIRMWARE_HANDLER_CATEGORY, \
341  _desc, \
342  info->mContractID, \
343  PR_TRUE, PR_TRUE, \
344  getter_Copies(prevEntry)); \
345  NS_ENSURE_SUCCESS(rv, rv); \
346  NS_WARN_IF_FALSE(prevEntry.IsEmpty(), \
347  "Another controller was registered with that id!"); \
348  return NS_OK; \
349  } \
350  \
351  NS_METHOD \
352  _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
353  nsIFile* aPath, \
354  const char* registryLocation, \
355  const nsModuleComponentInfo* info) \
356  { \
357  nsresult rv; \
358  nsCOMPtr<nsICategoryManager> catMan = \
359  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
360  NS_ENSURE_SUCCESS(rv, rv); \
361  rv = catMan->DeleteCategoryEntry(SB_DEVICE_FIRMWARE_HANDLER_CATEGORY, \
362  _desc, \
363  PR_TRUE); \
364  NS_ENSURE_SUCCESS(rv, rv); \
365  return NS_OK; \
366  }
367 %}
void update(in sbIDeviceFirmwareUpdate aFirmwareUpdate)
Perform a firmware update on the specified device.
readonly attribute AString latestFirmwareReadableVersion
The latest firmware version, in human readable format.
readonly attribute boolean needsRecoveryMode
Whether the device needs to be in recovery mode to have its firmware updated.
readonly attribute boolean recoveryMode
Indicates whether the device is in recovery mode or not.
void bind(in sbIDevice aDevice, in sbIDeviceEventListener aListener)
Bind the handler to a device.
readonly attribute unsigned long currentFirmwareVersion
The current firmware version, in machine friendly format.
void verifyDevice()
Verify the firmware already on the device.
readonly attribute nsIURI latestFirmwareLocation
URI for latest firmware (where it can be downloaded from).
boolean rebind(in sbIDevice aDevice, in sbIDeviceEventListener aListener)
Rebind a device to an already running handler.
var uuid
readonly attribute AString deviceModelNumber
Device model number / name as reported by the firmware handler.
boolean canUpdate(in sbIDevice aDevice, in unsigned long aDeviceVendorID, in unsigned long aDeviceProductID)
Check to see if this handler can update the specified device.
function C(H)
readonly attribute unsigned long latestFirmwareVersion
The latest firmware version, in machine friendly format.
void unbind()
Unbind the handler.
readonly attribute nsIURI registerLocation
Location where one can perform owner registration with the device manufacturer.
void cancel()
Cancel the current operation.
readonly attribute sbIDevice boundDevice
The device bound to this handler, or null.
readonly attribute nsIURI releaseNotesLocation
Location for the release notes of the latest firmware.
readonly attribute AString deviceVendor
Device manufacturer as reported by the firmware handler.
void recover(in sbIDeviceFirmwareUpdate aFirmwareUpdate)
Perform a recovery update on the specified device.
readonly attribute AString currentFirmwareReadableVersion
The current firmware version on the device, in human readable format (eg. xx.xx.xx.xx).
readonly attribute AString recoveryModeKeyCombination
Magic key combination required by the device to go into recovery or firmware flashing mode...
void verifyUpdate(in sbIDeviceFirmwareUpdate aFirmwareUpdate)
Verify the firmware update image.
readonly attribute sbIDeviceFirmwareUpdate defaultFirmwareUpdate
The default firmware update that is packaged with the firmware handler. This update should always be ...
void refreshInfo()
Refresh the firmware location, version, readable version, notes, and instructions.
readonly attribute nsISimpleEnumerator supportedDevices
Array containing the list of devices supported by the firmware handler.
readonly attribute AString deviceModelVersion
Device model version / version name as reported by the firmware handler.
readonly attribute AString contractId
The Contract ID for this handler.
readonly attribute nsIURI customerSupportLocation
Device Customer Support URL.
readonly attribute nsIURI resetInstructionsLocation
Location of the reset instructions.
void initiateRecoveryModeSwitch([optional] in unsigned long aDeviceVendorID, [optional] in unsigned long aDeviceProductID)
Notify the handler to expect a device to connect in recovery mode.