sbBaseDeviceVolume.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 :miv */
3 /*
4  *=BEGIN SONGBIRD GPL
5  *
6  * This file is part of the Songbird web player.
7  *
8  * Copyright(c) 2005-2010 POTI, Inc.
9  * http://www.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 #ifndef SB_BASE_DEVICE_VOLUME_H_
28 #define SB_BASE_DEVICE_VOLUME_H_
29 
35 //------------------------------------------------------------------------------
36 //
37 // Base device volume imported services.
38 //
39 //------------------------------------------------------------------------------
40 
41 // Local imports.
42 #include "sbDeviceStatistics.h"
43 
44 // Songbird imports.
45 #include <sbIDeviceLibrary.h>
46 
47 // Mozilla imports.
48 #include <nsAutoPtr.h>
49 #include <nsStringGlue.h>
50 
51 
52 //------------------------------------------------------------------------------
53 //
54 // Base device volume services defs.
55 //
56 //------------------------------------------------------------------------------
57 
58 class sbBaseDevice;
59 
60 
61 //------------------------------------------------------------------------------
62 //
63 // Base device volume services classes.
64 //
65 //------------------------------------------------------------------------------
66 
73 {
74  //----------------------------------------------------------------------------
75  //
76  // Public interface.
77  //
78  //----------------------------------------------------------------------------
79 
80 public:
81 
82  //
83  // Implemented interfaces.
84  //
85 
87 
88 
89  //
90  // Public base device volume services.
91  //
92 
100  static nsresult New(sbBaseDeviceVolume** aVolume,
101  sbBaseDevice* aDevice);
102 
106  virtual ~sbBaseDeviceVolume();
107 
108 
109  //
110  // Base device volume getters/setters.
111  //
112 
116  nsresult GetGUID(nsAString& aGUID);
117 
118  nsresult SetGUID(const nsAString& aGUID);
119 
123  nsresult GetIsMounted(PRBool* aIsMounted);
124 
125  nsresult SetIsMounted(PRBool aIsMounted);
126 
132  nsresult GetRemovable(PRInt32* aRemovable);
133 
134  nsresult SetRemovable(PRInt32 aRemovable);
135 
139  nsresult GetDeviceLibrary(sbIDeviceLibrary** aDeviceLibrary);
140 
141  nsresult SetDeviceLibrary(sbIDeviceLibrary* aDeviceLibrary);
142 
146  nsresult GetStatistics(sbDeviceStatistics** aStatistics);
147 
148 
149  //----------------------------------------------------------------------------
150  //
151  // Protected interface.
152  //
153  //----------------------------------------------------------------------------
154 
155 protected:
156 
157  //
158  // Protected base device volume fields.
159  //
160  // mVolumeLock All volume fields must be accessed under this
161  // lock.
162  //
163 
164  PRLock* mVolumeLock;
165 
166 
167  //
168  // Protected base device volume services.
169  //
170 
176  virtual nsresult Initialize(sbBaseDevice* aDevice);
177 
182 
183 
184  //----------------------------------------------------------------------------
185  //
186  // Private interface.
187  //
188  //----------------------------------------------------------------------------
189 
190 private:
191 
192  //
193  // Private base device volume fields.
194  //
195  // mDevice Device to which volume belongs. Device owns
196  // volume, so don't hold a device reference.
197  // mGUID Persistent unique ID specific to the media
198  // volume.
199  // mIsMounted If true, volume has been mounted.
200  // mRemovable 1 if removable, 0 if not removable, -1 if
201  // unknown.
202  // mDeviceLibrary Device library residing on volume.
203  // mStatistics Volume device statistics.
204  //
205 
206  sbBaseDevice* mDevice;
207  nsString mGUID;
208  PRBool mIsMounted;
209  PRInt32 mRemovable;
210  nsCOMPtr<sbIDeviceLibrary> mDeviceLibrary;
211  nsRefPtr<sbDeviceStatistics> mStatistics;
212 };
213 
214 
215 #endif /* SB_BASE_DEVICE_VOLUME_H_ */
216 
nsresult SetIsMounted(PRBool aIsMounted)
nsresult GetStatistics(sbDeviceStatistics **aStatistics)
nsresult GetIsMounted(PRBool *aIsMounted)
nsresult GetGUID(nsAString &aGUID)
nsresult GetRemovable(PRInt32 *aRemovable)
nsresult GetDeviceLibrary(sbIDeviceLibrary **aDeviceLibrary)
nsresult SetRemovable(PRInt32 aRemovable)
nsresult SetGUID(const nsAString &aGUID)
Songbird Device Statistics Definitions.
static NS_DECL_ISUPPORTS nsresult New(sbBaseDeviceVolume **aVolume, sbBaseDevice *aDevice)
nsresult SetDeviceLibrary(sbIDeviceLibrary *aDeviceLibrary)
virtual nsresult Initialize(sbBaseDevice *aDevice)