45 #include <sbIDeviceEvent.h>
59 NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag)
60 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag)
61 NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(
nsISupports, nsIWritablePropertyBag)
62 NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
63 NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
80 return NS_ERROR_NOT_IMPLEMENTED;
88 sbIPDProperties::InitDefaultName(
const nsAString& aDefaultName)
90 return NS_ERROR_NOT_IMPLEMENTED;
99 sbIPDProperties::InitVendorName(
const nsAString& aVendorName)
101 return NS_ERROR_NOT_IMPLEMENTED;
110 sbIPDProperties::InitModelNumber(nsIVariant* aModelNumber)
112 return NS_ERROR_NOT_IMPLEMENTED;
121 sbIPDProperties::InitSerialNumber(nsIVariant* aSerialNumber)
123 return NS_ERROR_NOT_IMPLEMENTED;
131 sbIPDProperties::InitFirmwareVersion(
const nsAString &aFirmwareVersion)
133 return NS_ERROR_NOT_IMPLEMENTED;
141 sbIPDProperties::InitDeviceLocation(nsIURI* aDeviceLocationUri)
143 return NS_ERROR_NOT_IMPLEMENTED;
152 sbIPDProperties::InitDeviceIcon(nsIURI* aDeviceIconUri)
154 return NS_ERROR_NOT_IMPLEMENTED;
163 sbIPDProperties::InitDeviceProperties(nsIPropertyBag2* aProperties)
165 return NS_ERROR_NOT_IMPLEMENTED;
175 sbIPDProperties::InitDone()
177 return NS_ERROR_NOT_IMPLEMENTED;
192 sbIPDProperties::GetFriendlyName(nsAString& aFriendlyName)
194 return GetPropertyAsAString(NS_LITERAL_STRING(
"FriendlyName"), aFriendlyName);
198 sbIPDProperties::SetFriendlyName(
const nsAString& aFriendlyName)
210 sbIPDProperties::GetDefaultName(nsAString& aDefaultName)
212 return GetPropertyAsAString(
223 sbIPDProperties::GetVendorName(nsAString& aVendorName)
236 sbIPDProperties::GetModelNumber(nsIVariant** aModelNumber)
248 sbIPDProperties::GetSerialNumber(nsIVariant** aSerialNumber)
255 sbIPDProperties::GetFirmwareVersion(nsAString &aFirmwareVersion)
257 aFirmwareVersion.Truncate();
267 sbIPDProperties::GetUri(nsIURI** aUri)
269 return NS_ERROR_FAILURE;
279 sbIPDProperties::GetIconUri(nsIURI** aIconUri)
281 return GetPropertyAsInterface(NS_LITERAL_STRING(
"DeviceIcon"),
288 sbIPDProperties::SetHidden(PRBool aHidden)
293 NS_ENSURE_SUCCESS(rv, rv);
297 NS_ENSURE_SUCCESS(rv, rv);
304 sbIPDProperties::GetHidden(PRBool *aHidden)
306 NS_ENSURE_ARG_POINTER(aHidden);
308 nsresult rv = mProperties2->GetPropertyAsBool(
311 NS_ENSURE_SUCCESS(rv, rv);
323 sbIPDProperties::GetProperties(nsIPropertyBag2** aProperties)
326 NS_ENSURE_ARG_POINTER(aProperties);
329 NS_ADDREF(*aProperties =
this);
348 sbIPDProperties::SetProperty(
const nsAString&
name,
352 NS_ENSURE_ARG_POINTER(value);
360 if (name.EqualsLiteral(
"FriendlyName")) {
361 rv = mDevice->ReqPushSetNamedValue(sbIPDDevice::REQUEST_SET_PROPERTY,
364 NS_ENSURE_SUCCESS(rv, rv);
367 rv = mDevice->SetIsSetUp(PR_TRUE);
368 NS_ENSURE_SUCCESS(rv, rv);
372 rv = mProperties->SetProperty(name, value);
373 NS_ENSURE_SUCCESS(rv, rv);
378 NS_ENSURE_SUCCESS(rv, rv);
391 sbIPDProperties::DeleteProperty(
const nsAString& name)
393 return mProperties->DeleteProperty(name);
411 NS_ASSERTION(mDevice,
"mDevice is null");
434 mProperties = do_CreateInstance(
"@songbirdnest.com/moz/xpcom/sbpropertybag;1", &rv);
435 NS_ENSURE_SUCCESS(rv, rv);
436 mProperties2 = do_QueryInterface(mProperties, &rv);
437 NS_ENSURE_SUCCESS(rv, rv);
440 nsCOMPtr<nsIPropertyBag2> parameters;
441 nsAutoString property;
442 rv = mDevice->GetParameters(getter_AddRefs(parameters));
443 NS_ENSURE_SUCCESS(rv, rv);
444 rv = parameters->GetPropertyAsAString
447 NS_ENSURE_SUCCESS(rv, rv);
448 rv = mProperties2->SetPropertyAsAString
451 NS_ENSURE_SUCCESS(rv, rv);
452 rv = parameters->GetPropertyAsAString
455 NS_ENSURE_SUCCESS(rv, rv);
456 rv = mProperties2->SetPropertyAsAString
459 NS_ENSURE_SUCCESS(rv, rv);
460 rv = parameters->GetPropertyAsAString
463 NS_ENSURE_SUCCESS(rv, rv);
464 rv = mProperties2->SetPropertyAsAString
467 NS_ENSURE_SUCCESS(rv, rv);
468 rv = mProperties2->SetPropertyAsBool
473 rv = mProperties2->SetPropertyAsAString
475 NS_LITERAL_STRING(
"rw"));
476 NS_ENSURE_SUCCESS(rv, rv);
479 rv = mProperties2->SetPropertyAsInterface
480 (NS_LITERAL_STRING(
"DeviceIcon"),
481 sbIPDURI(
"chrome://ipod/skin/icon-ipod.png").
get());
482 NS_ENSURE_SUCCESS(rv, rv);
497 mProperties = nsnull;
498 mProperties2 = nsnull;
515 NS_ENSURE_ARG_POINTER(aValue);
518 return mProperties->SetProperty(aName, aValue);
nsresult CreateAndDispatchEvent(PRUint32 aType, nsIVariant *aData, PRBool aAsync=PR_TRUE, sbIDeviceEventTarget *aTarget=nsnull)
virtual ~sbIPDProperties()
#define SB_DEVICE_PROPERTY_HIDDEN
NS_IMETHOD SetPropertyAsAString(const nsAString &aName, const nsAString &aValue)
Songbird iPod Device Properties Definitions.
#define SB_DEVICE_PROPERTY_ACCESS_COMPATIBILITY
#define SB_DEVICE_PROPERTY_MANUFACTURER
#define SB_DEVICE_PROPERTY_DEFAULT_NAME
NS_IMPL_THREADSAFE_RELEASE(sbRequestItem)
NS_IMPL_THREADSAFE_ADDREF(sbRequestItem)
Songbird iPod Device Definitions.
static nsresult GetProperty(nsIPropertyBag2 *aProperties, nsAString const &aProp, nsAString &aValue)
const unsigned long EVENT_DEVICE_INFO_CHANGED
sbIPDProperties(sbIPDDevice *aDevice)
#define SB_DEVICE_PROPERTY_SERIAL_NUMBER
nsresult SetPropertyInternal(const nsAString &aName, nsIVariant *aValue)
#define SB_DEVICE_PROPERTY_MODEL