51 #include <nsAutoPtr.h>
52 #include <nsIClassInfoImpl.h>
53 #include <nsIGenericFactory.h>
54 #include <nsIProgrammingLanguage.h>
55 #include <nsIPropertyBag.h>
56 #include <nsIVariant.h>
57 #include <nsIWritablePropertyBag.h>
59 #include <nsServiceManagerUtils.h>
101 sbIPDController::GetCompatibility(nsIPropertyBag* aParams,
105 NS_ENSURE_ARG_POINTER(aParams);
106 NS_ENSURE_ARG_POINTER(_retval);
112 nsRefPtr<sbDeviceCompatibility> deviceCompatibility;
114 NS_ENSURE_TRUE(deviceCompatibility, NS_ERROR_OUT_OF_MEMORY);
117 nsCOMPtr<nsIVariant> property;
118 nsAutoString deviceType;
119 rv = aParams->GetProperty(NS_LITERAL_STRING(
"DeviceType"),
120 getter_AddRefs(property));
121 NS_ENSURE_SUCCESS(rv, rv);
122 rv =
property->GetAsAString(deviceType);
123 NS_ENSURE_SUCCESS(rv, rv);
126 if (deviceType.EqualsLiteral(
"iPod")) {
127 rv = deviceCompatibility->Init
131 rv = deviceCompatibility->Init
135 NS_ENSURE_SUCCESS(rv, rv);
138 NS_ADDREF(*_retval = deviceCompatibility);
149 sbIPDController::CreateDevice(nsIPropertyBag* aParams,
153 NS_ENSURE_ARG_POINTER(aParams);
154 NS_ENSURE_ARG_POINTER(_retval);
162 NS_ENSURE_SUCCESS(rv, rv);
165 nsRefPtr<sbIPDSysDevice> device =
new sbIPDSysDevice(controllerID, aParams);
166 NS_ENSURE_TRUE(device, NS_ERROR_OUT_OF_MEMORY);
167 rv = device->Initialize();
168 NS_ENSURE_SUCCESS(rv, rv);
172 NS_ENSURE_SUCCESS(rv, rv);
175 NS_ADDREF(*_retval = device);
186 sbIPDController::ControlsDevice(
sbIDevice* aDevice,
198 sbIPDController::ConnectDevices()
209 sbIPDController::DisconnectDevices()
220 sbIPDController::ReleaseDevice(
sbIDevice* aDevice)
231 sbIPDController::ReleaseDevices()
246 sbIPDController::GetId(nsID** aId)
249 NS_ENSURE_ARG_POINTER(aId);
255 nsID* pId =
static_cast<nsID*
>(NS_Alloc(
sizeof(nsID)));
256 NS_ENSURE_TRUE(pId, NS_ERROR_OUT_OF_MEMORY);
261 NS_ENSURE_SUCCESS(rv, rv);
264 *aId =
static_cast<nsID*
>(autoPId.forget());
275 sbIPDController::GetName(nsAString&
aName)
287 sbIPDController::GetMarshallId(nsID** aId)
290 NS_ENSURE_ARG_POINTER(aId);
296 nsID* pId =
static_cast<nsID*
>(NS_Alloc(
sizeof(nsID)));
297 NS_ENSURE_TRUE(pId, NS_ERROR_OUT_OF_MEMORY);
302 NS_ENSURE_SUCCESS(rv, rv);
305 *aId =
static_cast<nsID*
>(autoPId.forget());
318 sbIPDController::GetDevices(nsIArray** aDevices)
344 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to set controller ID.");
349 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to set marshall ID.");
353 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to set controller name.");
nsresult DisconnectDevicesInternal()
Songbird iPod Device Utility Definitions.
nsresult ReleaseDeviceInternal(sbIDevice *aDevice)
nsresult GetMarshallIdInternal(nsID &aID)
NS_DECL_ISUPPORTS NS_DECL_SBIDEVICECONTROLLER NS_DECL_NSICLASSINFO sbIPDController()
NS_IMPL_THREADSAFE_RELEASE(sbRequestItem)
NS_IMPL_THREADSAFE_ADDREF(sbRequestItem)
virtual ~sbIPDController()
nsresult SetMarshallIdInternal(const nsID &aID)
[UNIMPLEMENTED UNTIL AFTER 0.3]
nsresult SetControllerNameInternal(const nsAString &aName)
nsresult ReleaseDevicesInternal()
const unsigned long PREFERENCE_SELECTED
nsresult GetControllerNameInternal(nsAString &aName)
Songbird iPod Device Logging Definitions.
[UNIMPLEMENTED UNTIL AFTER 0.3]
#define SB_IPDCONTROLLER_CONTRACTID
nsresult GetDevicesInternal(nsIArray **aDevices)
nsresult AddDeviceInternal(sbIDevice *aDevice)
nsresult GetControllerIdInternal(nsID &aID)
const unsigned long COMPATIBLE_ENHANCED_SUPPORT
nsresult ControlsDeviceInternal(sbIDevice *aDevice, PRBool *_retval)
nsresult SetControllerIdInternal(const nsID &aID)
#define SB_IPDMARSHALL_CID
#define SB_IPDCONTROLLER_CID
const unsigned long PREFERENCE_UNKNOWN
nsresult ConnectDevicesInternal()
SB_DEVICE_CONTROLLER_REGISTERSELF_IMPL(sbIPDController,"@songbirdnest.com/Songbird/IPDController;1") NS_IMETHODIMP sbIPDController
#define SB_IPDCONTROLLER_CLASSNAME
NS_INTERFACE_MAP_END NS_IMPL_CI_INTERFACE_GETTER1(CDatabaseQuery, sbIDatabaseQuery) CDatabaseQuery
const unsigned long INCOMPATIBLE