52 #include <nsAutoPtr.h>
53 #include <nsIClassInfoImpl.h>
54 #include <nsIGenericFactory.h>
55 #include <nsIProgrammingLanguage.h>
56 #include <nsIPropertyBag.h>
57 #include <nsIVariant.h>
58 #include <nsIWritablePropertyBag.h>
60 #include <nsServiceManagerUtils.h>
102 sbIPDController::GetCompatibility(nsIPropertyBag* aParams,
106 NS_ENSURE_ARG_POINTER(aParams);
107 NS_ENSURE_ARG_POINTER(_retval);
113 nsRefPtr<sbDeviceCompatibility> deviceCompatibility;
115 NS_ENSURE_TRUE(deviceCompatibility, NS_ERROR_OUT_OF_MEMORY);
118 nsCOMPtr<nsIVariant> property;
119 nsAutoString deviceType;
120 rv = aParams->GetProperty(NS_LITERAL_STRING(
"DeviceType"),
121 getter_AddRefs(property));
122 NS_ENSURE_SUCCESS(rv, rv);
123 rv =
property->GetAsAString(deviceType);
124 NS_ENSURE_SUCCESS(rv, rv);
127 if (deviceType.EqualsLiteral(
"iPod")) {
128 rv = deviceCompatibility->Init
132 rv = deviceCompatibility->Init
136 NS_ENSURE_SUCCESS(rv, rv);
139 NS_ADDREF(*_retval = deviceCompatibility);
150 sbIPDController::CreateDevice(nsIPropertyBag* aParams,
154 NS_ENSURE_ARG_POINTER(aParams);
155 NS_ENSURE_ARG_POINTER(_retval);
160 LOG(
"sbIPDController::CreateDevice");
165 NS_ENSURE_SUCCESS(rv, rv);
168 nsRefPtr<sbIPDSysDevice> device =
new sbIPDSysDevice(controllerID, aParams);
169 NS_ENSURE_TRUE(device, NS_ERROR_OUT_OF_MEMORY);
170 rv = device->Initialize();
171 NS_ENSURE_SUCCESS(rv, rv);
175 NS_ENSURE_SUCCESS(rv, rv);
178 NS_ADDREF(*_retval = device);
189 sbIPDController::ControlsDevice(
sbIDevice* aDevice,
201 sbIPDController::ConnectDevices()
212 sbIPDController::DisconnectDevices()
223 sbIPDController::ReleaseDevice(
sbIDevice* aDevice)
234 sbIPDController::ReleaseDevices()
249 sbIPDController::GetId(nsID** aId)
252 NS_ENSURE_ARG_POINTER(aId);
258 nsID* pId =
static_cast<nsID*
>(NS_Alloc(
sizeof(nsID)));
259 NS_ENSURE_TRUE(pId, NS_ERROR_OUT_OF_MEMORY);
264 NS_ENSURE_SUCCESS(rv, rv);
267 *aId =
static_cast<nsID*
>(autoPId.forget());
278 sbIPDController::GetName(nsAString&
aName)
290 sbIPDController::GetMarshallId(nsID** aId)
293 NS_ENSURE_ARG_POINTER(aId);
299 nsID* pId =
static_cast<nsID*
>(NS_Alloc(
sizeof(nsID)));
300 NS_ENSURE_TRUE(pId, NS_ERROR_OUT_OF_MEMORY);
305 NS_ENSURE_SUCCESS(rv, rv);
308 *aId =
static_cast<nsID*
>(autoPId.forget());
321 sbIPDController::GetDevices(nsIArray** aDevices)
349 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to set controller ID.");
354 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to set marshall ID.");
358 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to set controller name.");
#define SB_PRLOG_SETUP(x)
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