sbIDeviceController.idl
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25 */
26 
27 #include "nsISupports.idl"
28 
29 interface nsIPropertyBag;
30 interface nsIArray;
31 
32 interface sbIDevice;
33 interface sbIDeviceCompatibility;
34 
40 [scriptable, uuid(b4b7ed5d-85f2-4d0b-a7c6-f235acad3fc0)]
42 {
46  readonly attribute nsIDPtr id;
47 
51  readonly attribute AString name;
52 
57  readonly attribute nsIDPtr marshallId;
58 
64  readonly attribute nsIArray devices;
65 
70  sbIDeviceCompatibility getCompatibility(in nsIPropertyBag aParams);
71 
75  sbIDevice createDevice(in nsIPropertyBag aParams);
76 
80  boolean controlsDevice(in sbIDevice aDevice);
81 
85  void connectDevices();
86 
90  void disconnectDevices();
91 
95  void releaseDevice(in sbIDevice aDevice);
96 
100  void releaseDevices();
101 };
102 
103 %{C++
104 #include "nsCOMPtr.h"
105 #include "nsIComponentManager.h"
106 #include "nsICategoryManager.h"
107 #include "nsIServiceManager.h"
108 #include "nsStringGlue.h"
109 #include "nsXPCOMCID.h"
110 
111 class nsIFile;
112 struct nsModuleComponentInfo;
113 
114 #define SB_DEVICE_CONTROLLER_CATEGORY "songbird-device-controller"
115 
137 #define SB_DEVICE_CONTROLLER_REGISTERSELF(_name) \
138  \
139  NS_METHOD _name##RegisterSelf(nsIComponentManager* aCompMgr, \
140  nsIFile* aPath, \
141  const char* registryLocation, \
142  const char* componentType, \
143  const nsModuleComponentInfo* info); \
144  \
145  NS_METHOD _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
146  nsIFile* aPath, \
147  const char* registryLocation, \
148  const nsModuleComponentInfo* info)
149 
153 #define SB_DEVICE_CONTROLLER_REGISTERSELF_IMPL(_name, _desc) \
154  \
155  NS_METHOD \
156  _name##RegisterSelf(nsIComponentManager* aCompMgr, \
157  nsIFile* aPath, \
158  const char* registryLocation, \
159  const char* componentType, \
160  const nsModuleComponentInfo* info) \
161  { \
162  nsresult rv; \
163  nsCOMPtr<nsICategoryManager> catMan = \
164  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
165  NS_ENSURE_SUCCESS(rv, rv); \
166  nsCAutoString prevEntry; \
167  rv = catMan->AddCategoryEntry(SB_DEVICE_CONTROLLER_CATEGORY, \
168  _desc, \
169  info->mContractID, \
170  PR_TRUE, PR_TRUE, \
171  getter_Copies(prevEntry)); \
172  NS_ENSURE_SUCCESS(rv, rv); \
173  NS_WARN_IF_FALSE(prevEntry.IsEmpty(), \
174  "Another controller was registered with that id!"); \
175  return NS_OK; \
176  } \
177  \
178  NS_METHOD \
179  _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
180  nsIFile* aPath, \
181  const char* registryLocation, \
182  const nsModuleComponentInfo* info) \
183  { \
184  nsresult rv; \
185  nsCOMPtr<nsICategoryManager> catMan = \
186  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
187  NS_ENSURE_SUCCESS(rv, rv); \
188  rv = catMan->DeleteCategoryEntry(SB_DEVICE_CONTROLLER_CATEGORY, \
189  _desc, \
190  PR_TRUE); \
191  NS_ENSURE_SUCCESS(rv, rv); \
192  return NS_OK; \
193  }
194 %}
boolean controlsDevice(in sbIDevice aDevice)
readonly attribute nsIDPtr marshallId
readonly attribute AString name
var uuid
function C(H)
readonly attribute nsIDPtr id
[UNIMPLEMENTED UNTIL AFTER 0.3]
[UNIMPLEMENTED UNTIL AFTER 0.3]
sbIDeviceCompatibility getCompatibility(in nsIPropertyBag aParams)
void releaseDevice(in sbIDevice aDevice)
sbIDevice createDevice(in nsIPropertyBag aParams)
readonly attribute nsIArray devices