sbIDeviceMarshall.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 
30 interface sbIDevice;
31 
35 [scriptable, uuid(e5219882-1dd1-11b2-a99d-c2250594367c)]
37 {
41  readonly attribute nsIDPtr id;
42 
46  readonly attribute AString name;
47 
53 
54  void beginMonitoring();
55 
60  void stopMonitoring();
61 
65  void removeDevice(in sbIDevice aDevice);
66 };
67 
68 %{C++
69 #include "nsCOMPtr.h"
70 #include "nsIComponentManager.h"
71 #include "nsICategoryManager.h"
72 #include "nsIServiceManager.h"
73 #include "nsStringGlue.h"
74 #include "nsXPCOMCID.h"
75 
76 class nsIFile;
77 struct nsModuleComponentInfo;
78 
79 #define SB_DEVICE_MARSHALL_CATEGORY "songbird-device-marshall"
80 
102 #define SB_DEVICE_MARSHALL_REGISTERSELF(_name) \
103  \
104  static NS_METHOD _name##RegisterSelf(nsIComponentManager* aCompMgr, \
105  nsIFile* aPath, \
106  const char* registryLocation, \
107  const char* componentType, \
108  const nsModuleComponentInfo* info); \
109  \
110  static NS_METHOD _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
111  nsIFile* aPath, \
112  const char* registryLocation, \
113  const nsModuleComponentInfo* info)
114 
118 #define SB_DEVICE_MARSHALL_REGISTERSELF_IMPL(_name) \
119  \
120  NS_METHOD \
121  _name##RegisterSelf(nsIComponentManager* aCompMgr, \
122  nsIFile* aPath, \
123  const char* registryLocation, \
124  const char* componentType, \
125  const nsModuleComponentInfo* info) \
126  { \
127  nsresult rv; \
128  nsCOMPtr<nsICategoryManager> catMan = \
129  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
130  NS_ENSURE_SUCCESS(rv, rv); \
131  nsID id; \
132  rv = this->GetIdInPlace(&id); \
133  NS_ENSURE_SUCCESS(rv, rv); \
134  nsCAutoString idString(id.ToString()); \
135  NS_ENSURE_STATE(!idString.IsEmpty()); \
136  nsXPIDLCString prevEntry; \
137  rv = catMan->AddCategoryEntry(SB_DEVICE_MARSHALL_CATEGORY, \
138  idString.get(), \
139  info->mContractID, \
140  PR_TRUE, PR_TRUE, \
141  getter_Copies(prevEntry)); \
142  NS_ENSURE_SUCCESS(rv, rv); \
143  NS_WARN_IF_FALSE(prevEntry.IsEmpty(), \
144  "Another marshall was registered with that id!"); \
145  return NS_OK; \
146  } \
147  \
148  NS_METHOD \
149  _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
150  nsIFile* aPath, \
151  const char* registryLocation, \
152  const nsModuleComponentInfo* info) \
153  { \
154  nsresult rv; \
155  nsCOMPtr<nsICategoryManager> catMan = \
156  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
157  NS_ENSURE_SUCCESS(rv, rv); \
158  nsID id; \
159  rv = this->GetIdInPlace(&id); \
160  NS_ENSURE_SUCCESS(rv, rv); \
161  nsCAutoString idString(id.ToString()); \
162  NS_ENSURE_STATE(!idString.IsEmpty()); \
163  rv = catMan->DeleteCategoryEntry(SB_DEVICE_MARSHALL_CATEGORY, \
164  idString.get(), \
165  PR_TRUE); \
166  NS_ENSURE_SUCCESS(rv, rv); \
167  return NS_OK; \
168  }
169 %}
var uuid
function C(H)
void loadControllers(in sbIDeviceControllerRegistrar aRegistrar)
[UNIMPLEMENTED UNTIL AFTER 0.3]
void removeDevice(in sbIDevice aDevice)
readonly attribute nsIDPtr id
readonly attribute AString name