sbBaseDeviceController.h
Go to the documentation of this file.
1 /* vim: set sw=2 :miv */
2 /*
3 //
4 // BEGIN SONGBIRD GPL
5 //
6 // This file is part of the Songbird web player.
7 //
8 // Copyright(c) 2005-2008 POTI, Inc.
9 // http://songbirdnest.com
10 //
11 // This file may be licensed under the terms of of the
12 // GNU General Public License Version 2 (the "GPL").
13 //
14 // Software distributed under the License is distributed
15 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
16 // express or implied. See the GPL for the specific language
17 // governing rights and limitations.
18 //
19 // You should have received a copy of the GPL along with this
20 // program. If not, go to http://www.gnu.org/licenses/gpl.html
21 // or write to the Free Software Foundation, Inc.,
22 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 //
24 // END SONGBIRD GPL
25 //
26 */
27 
28 #include <sbIDevice.h>
29 
30 #include <prmon.h>
31 #include <nsID.h>
32 #include <nsHashKeys.h>
33 
34 #include <nsIClassInfo.h>
35 #include <nsInterfaceHashtable.h>
36 #include <nsIMutableArray.h>
37 #include <nsStringGlue.h>
38 
40 {
41 public:
43 
44 protected:
45  virtual ~sbBaseDeviceController();
46 
47 protected:
48  // copies the given hash table into the given mutable array
49  template<class T>
50  static NS_HIDDEN_(PLDHashOperator) EnumerateIntoArray(const nsID& aKey,
51  T* aData,
52  void* aArray);
53  template<class T>
54  static NS_HIDDEN_(PLDHashOperator) EnumerateConnectAll(const nsID& aKey,
55  T* aData,
56  void* aArray);
57 
58  template<class T>
59  static NS_HIDDEN_(PLDHashOperator) EnumerateDisconnectAll(const nsID& aKey,
60  T* aData,
61  void* aArray);
62 
66  nsresult GetControllerIdInternal(nsID &aID);
70  nsresult SetControllerIdInternal(const nsID &aID);
71 
75  nsresult GetControllerNameInternal(nsAString &aName);
79  nsresult SetControllerNameInternal(const nsAString &aName);
80 
84  nsresult GetMarshallIdInternal(nsID &aID);
88  nsresult SetMarshallIdInternal(const nsID &aID);
89 
93  nsresult AddDeviceInternal(sbIDevice *aDevice);
97  nsresult RemoveDeviceInternal(sbIDevice *aDevice);
98 
102  nsresult GetDeviceInternal(const nsID * aID, sbIDevice* *aDevice);
103 
107  nsresult GetDevicesInternal(nsIArray* *aDevices);
108 
112  nsresult ControlsDeviceInternal(sbIDevice *aDevice, PRBool *_retval);
113 
117  nsresult ConnectDevicesInternal();
118 
122  nsresult DisconnectDevicesInternal();
123 
127  nsresult ReleaseDeviceInternal(sbIDevice *aDevice);
128 
132  nsresult ReleaseDevicesInternal();
133 
134 private:
138  PRMonitor* mMonitor;
139 
143  nsID mControllerID;
144 
148  nsString mControllerName;
149 
153  nsID mMarshallID;
154 
158  nsInterfaceHashtable<nsIDHashKey, sbIDevice> mDevices;
159 };
nsresult GetDeviceInternal(const nsID *aID, sbIDevice **aDevice)
static NS_HIDDEN_(PLDHashOperator) EnumerateIntoArray(const nsID &aKey
nsresult ReleaseDeviceInternal(sbIDevice *aDevice)
nsresult GetMarshallIdInternal(nsID &aID)
nsresult SetMarshallIdInternal(const nsID &aID)
nsresult SetControllerNameInternal(const nsAString &aName)
nsresult GetControllerNameInternal(nsAString &aName)
nsresult RemoveDeviceInternal(sbIDevice *aDevice)
nsresult GetDevicesInternal(nsIArray **aDevices)
nsresult AddDeviceInternal(sbIDevice *aDevice)
nsresult GetControllerIdInternal(nsID &aID)
_updateCookies aName
nsresult ControlsDeviceInternal(sbIDevice *aDevice, PRBool *_retval)
nsresult SetControllerIdInternal(const nsID &aID)