Changeset 13659 in vbox
- Timestamp:
- Oct 29, 2008 3:45:03 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38602
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/RemoteUSBDeviceImpl.cpp
r8155 r13659 1 /* $Id$ */ 2 1 3 /** @file 2 4 * … … 6 8 7 9 /* 8 * Copyright (C) 2006-200 7Sun Microsystems, Inc.10 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 9 11 * 10 12 * This file is part of VirtualBox Open Source Edition (OSE), as … … 26 28 #include <VBox/err.h> 27 29 30 #include <VBox/vrdpapi.h> 28 31 #include <VBox/vrdpusb.h> 29 32 … … 40 43 void RemoteUSBDevice::FinalRelease() 41 44 { 42 if (isReady()) 43 uninit(); 45 uninit(); 44 46 } 45 47 … … 54 56 HRESULT RemoteUSBDevice::init (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevDesc) 55 57 { 56 LogFlowMember (("RemoteUSBDevice::init()\n")); 57 58 AutoWriteLock alock (this); 59 ComAssertRet (!isReady(), E_UNEXPECTED); 60 61 mId.create(); 62 63 mVendorId = pDevDesc->idVendor; 64 mProductId = pDevDesc->idProduct; 65 mRevision = pDevDesc->bcdRev; 66 67 mManufacturer = pDevDesc->oManufacturer? (char *)pDevDesc + pDevDesc->oManufacturer: ""; 68 mProduct = pDevDesc->oProduct? (char *)pDevDesc + pDevDesc->oProduct: ""; 69 mSerialNumber = pDevDesc->oSerialNumber? (char *)pDevDesc + pDevDesc->oSerialNumber: ""; 58 LogFlowThisFunc (("u32ClientId=%d,pDevDesc=%p\n", u32ClientId, pDevDesc)); 59 60 /* Enclose the state transition NotReady->InInit->Ready */ 61 AutoInitSpan autoInitSpan (this); 62 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 63 64 unconst (mData.id).create(); 65 66 unconst (mData.vendorId) = pDevDesc->idVendor; 67 unconst (mData.productId) = pDevDesc->idProduct; 68 unconst (mData.revision) = pDevDesc->bcdRev; 69 70 unconst (mData.manufacturer) = pDevDesc->oManufacturer? (char *)pDevDesc + pDevDesc->oManufacturer: ""; 71 unconst (mData.product) = pDevDesc->oProduct? (char *)pDevDesc + pDevDesc->oProduct: ""; 72 unconst (mData.serialNumber) = pDevDesc->oSerialNumber? (char *)pDevDesc + pDevDesc->oSerialNumber: ""; 70 73 71 74 char id[64]; 72 75 RTStrPrintf(id, sizeof (id), REMOTE_USB_BACKEND_PREFIX_S "0x%08X&0x%08X", pDevDesc->id, u32ClientId); 73 mAddress = id; 74 75 mPort = pDevDesc->idPort; 76 mVersion = pDevDesc->bcdUSB >> 8; 77 mPortVersion = mVersion; /** @todo fix this */ 78 79 mState = USBDeviceState_Available; 80 81 mDirty = false; 82 mDevId = pDevDesc->id; 83 84 mClientId = u32ClientId; 85 86 setReady (true); 76 unconst (mData.address) = id; 77 78 unconst (mData.port) = pDevDesc->idPort; 79 unconst (mData.version) = pDevDesc->bcdUSB >> 8; 80 unconst (mData.portVersion) = mData.version; /** @todo fix this */ 81 82 mData.state = USBDeviceState_Available; 83 84 mData.dirty = false; 85 unconst (mData.devId) = pDevDesc->id; 86 87 unconst (mData.clientId) = u32ClientId; 88 89 /* Confirm a successful initialization */ 90 autoInitSpan.setSucceeded(); 91 87 92 return S_OK; 88 93 } … … 95 100 void RemoteUSBDevice::uninit() 96 101 { 97 LogFlowMember (("RemoteUSBDevice::uninit()\n")); 98 99 AutoWriteLock alock (this); 100 AssertReturn (isReady(), (void) 0); 101 102 setReady (false); 102 LogFlowThisFunc (("\n")); 103 104 /* Enclose the state transition Ready->InUninit->NotReady */ 105 AutoUninitSpan autoUninitSpan (this); 106 if (autoUninitSpan.uninitDone()) 107 return; 108 109 unconst (mData.id).clear(); 110 111 unconst (mData.vendorId) = 0; 112 unconst (mData.productId) = 0; 113 unconst (mData.revision) = 0; 114 115 unconst (mData.manufacturer).setNull(); 116 unconst (mData.product).setNull(); 117 unconst (mData.serialNumber).setNull(); 118 119 unconst (mData.address).setNull(); 120 121 unconst (mData.port) = 0; 122 unconst (mData.version) = 1; 123 unconst (mData.portVersion) = 1; 124 125 unconst (mData.dirty) = FALSE; 126 127 unconst (mData.devId) = 0; 128 unconst (mData.clientId) = 0; 103 129 } 104 130 … … 111 137 return E_INVALIDARG; 112 138 113 AutoWriteLock alock (this); 114 CHECK_READY(); 115 116 mId.cloneTo (aId); 139 AutoCaller autoCaller (this); 140 CheckComRCReturnRC (autoCaller.rc()); 141 142 /* this is const, no need to lock */ 143 mData.id.cloneTo (aId); 144 117 145 return S_OK; 118 146 } … … 123 151 return E_INVALIDARG; 124 152 125 AutoWriteLock alock (this); 126 CHECK_READY(); 127 128 *aVendorId = mVendorId; 153 AutoCaller autoCaller (this); 154 CheckComRCReturnRC (autoCaller.rc()); 155 156 /* this is const, no need to lock */ 157 *aVendorId = mData.vendorId; 158 129 159 return S_OK; 130 160 } … … 135 165 return E_INVALIDARG; 136 166 137 AutoWriteLock alock (this); 138 CHECK_READY(); 139 140 *aProductId = mProductId; 167 AutoCaller autoCaller (this); 168 CheckComRCReturnRC (autoCaller.rc()); 169 170 /* this is const, no need to lock */ 171 *aProductId = mData.productId; 172 141 173 return S_OK; 142 174 } … … 147 179 return E_INVALIDARG; 148 180 149 AutoWriteLock alock (this); 150 CHECK_READY(); 151 152 *aRevision = mRevision; 181 AutoCaller autoCaller (this); 182 CheckComRCReturnRC (autoCaller.rc()); 183 184 /* this is const, no need to lock */ 185 *aRevision = mData.revision; 186 153 187 return S_OK; 154 188 } … … 159 193 return E_INVALIDARG; 160 194 161 AutoWriteLock alock (this); 162 CHECK_READY(); 163 164 mManufacturer.cloneTo (aManufacturer); 195 AutoCaller autoCaller (this); 196 CheckComRCReturnRC (autoCaller.rc()); 197 198 /* this is const, no need to lock */ 199 mData.manufacturer.cloneTo (aManufacturer); 200 165 201 return S_OK; 166 202 } … … 171 207 return E_INVALIDARG; 172 208 173 AutoWriteLock alock (this); 174 CHECK_READY(); 175 176 mProduct.cloneTo (aProduct); 209 AutoCaller autoCaller (this); 210 CheckComRCReturnRC (autoCaller.rc()); 211 212 /* this is const, no need to lock */ 213 mData.product.cloneTo (aProduct); 214 177 215 return S_OK; 178 216 } … … 183 221 return E_INVALIDARG; 184 222 185 AutoWriteLock alock (this); 186 CHECK_READY(); 187 188 mSerialNumber.cloneTo (aSerialNumber); 223 AutoCaller autoCaller (this); 224 CheckComRCReturnRC (autoCaller.rc()); 225 226 /* this is const, no need to lock */ 227 mData.serialNumber.cloneTo (aSerialNumber); 228 189 229 return S_OK; 190 230 } … … 195 235 return E_INVALIDARG; 196 236 197 AutoWriteLock alock (this); 198 CHECK_READY(); 199 200 mAddress.cloneTo (aAddress); 237 AutoCaller autoCaller (this); 238 CheckComRCReturnRC (autoCaller.rc()); 239 240 /* this is const, no need to lock */ 241 mData.address.cloneTo (aAddress); 242 201 243 return S_OK; 202 244 } … … 207 249 return E_INVALIDARG; 208 250 209 AutoWriteLock alock (this); 210 CHECK_READY(); 211 212 *aPort = mPort; 251 AutoCaller autoCaller (this); 252 CheckComRCReturnRC (autoCaller.rc()); 253 254 /* this is const, no need to lock */ 255 *aPort = mData.port; 256 213 257 return S_OK; 214 258 } … … 219 263 return E_INVALIDARG; 220 264 221 AutoWriteLock alock (this); 222 CHECK_READY(); 223 224 *aVersion = mVersion; 265 AutoCaller autoCaller (this); 266 CheckComRCReturnRC (autoCaller.rc()); 267 268 /* this is const, no need to lock */ 269 *aVersion = mData.version; 270 225 271 return S_OK; 226 272 } … … 231 277 return E_INVALIDARG; 232 278 233 AutoWriteLock alock (this); 234 CHECK_READY(); 235 236 *aPortVersion = mPortVersion; 279 AutoCaller autoCaller (this); 280 CheckComRCReturnRC (autoCaller.rc()); 281 282 /* this is const, no need to lock */ 283 *aPortVersion = mData.portVersion; 284 237 285 return S_OK; 238 286 } … … 243 291 return E_INVALIDARG; 244 292 245 Auto WriteLock alock(this);246 C HECK_READY();293 AutoCaller autoCaller (this); 294 CheckComRCReturnRC (autoCaller.rc()); 247 295 248 296 /* RemoteUSBDevice is always remote. */ 297 /* this is const, no need to lock */ 249 298 *aRemote = TRUE; 299 250 300 return S_OK; 251 301 } … … 259 309 return E_POINTER; 260 310 261 AutoWriteLock alock (this); 262 CHECK_READY(); 263 264 *aState = mState; 311 AutoCaller autoCaller (this); 312 CheckComRCReturnRC (autoCaller.rc()); 313 314 AutoReadLock alock (this); 315 316 *aState = mData.state; 317 265 318 return S_OK; 266 319 } -
trunk/src/VBox/Main/USBDeviceImpl.cpp
r8155 r13659 1 /* $Id$ */ 2 1 3 /** @file 2 4 * … … 5 7 6 8 /* 7 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 8 10 * 9 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 26 28 ///////////////////////////////////////////////////////////////////////////// 27 29 28 OUSBDevice::OUSBDevice() 29 { 30 mVendorId = 0; 31 mProductId = 0; 32 mRevision = 0; 33 34 mPort = 0; 35 mVersion = mPortVersion = 1; 36 mRemote = FALSE; 37 } 38 39 OUSBDevice::~OUSBDevice() 40 { 41 } 42 30 DEFINE_EMPTY_CTOR_DTOR (OUSBDevice) 31 32 HRESULT OUSBDevice::FinalConstruct() 33 { 34 return S_OK; 35 } 36 37 void OUSBDevice::FinalRelease() 38 { 39 uninit (); 40 } 43 41 44 42 // public initializer/uninitializer for internal purposes only … … 53 51 HRESULT OUSBDevice::init(IUSBDevice *aUSBDevice) 54 52 { 55 AutoWriteLock alock (this); 56 AssertReturn (!isReady(), E_UNEXPECTED); 57 58 HRESULT hrc = aUSBDevice->COMGETTER(VendorId)(&mVendorId); 59 ComAssertComRCRet (hrc, hrc); 60 ComAssertRet (mVendorId, E_INVALIDARG); 61 62 hrc = aUSBDevice->COMGETTER(ProductId)(&mProductId); 63 ComAssertComRCRet (hrc, hrc); 64 ComAssertRet (mProductId, E_INVALIDARG); 65 66 hrc = aUSBDevice->COMGETTER(Revision)(&mRevision); 67 ComAssertComRCRet (hrc, hrc); 68 69 hrc = aUSBDevice->COMGETTER(Manufacturer)(mManufacturer.asOutParam()); 70 ComAssertComRCRet (hrc, hrc); 71 72 hrc = aUSBDevice->COMGETTER(Product)(mProduct.asOutParam()); 73 ComAssertComRCRet (hrc, hrc); 74 75 hrc = aUSBDevice->COMGETTER(SerialNumber)(mSerialNumber.asOutParam()); 76 ComAssertComRCRet (hrc, hrc); 77 78 hrc = aUSBDevice->COMGETTER(Address)(mAddress.asOutParam()); 79 ComAssertComRCRet (hrc, hrc); 80 81 hrc = aUSBDevice->COMGETTER(Port)(&mPort); 82 ComAssertComRCRet (hrc, hrc); 83 84 hrc = aUSBDevice->COMGETTER(Port)(&mVersion); 85 ComAssertComRCRet (hrc, hrc); 86 87 hrc = aUSBDevice->COMGETTER(Port)(&mPortVersion); 88 ComAssertComRCRet (hrc, hrc); 89 90 hrc = aUSBDevice->COMGETTER(Remote)(&mRemote); 91 ComAssertComRCRet (hrc, hrc); 92 93 hrc = aUSBDevice->COMGETTER(Id)(mId.asOutParam()); 94 ComAssertComRCRet (hrc, hrc); 95 96 setReady(true); 97 return S_OK; 98 } 99 53 LogFlowThisFunc (("aUSBDevice=%p\n", aUSBDevice)); 54 55 ComAssertRet (aUSBDevice, E_INVALIDARG); 56 57 /* Enclose the state transition NotReady->InInit->Ready */ 58 AutoInitSpan autoInitSpan (this); 59 AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED); 60 61 HRESULT hrc = aUSBDevice->COMGETTER(VendorId)(&unconst (mData.vendorId)); 62 ComAssertComRCRet (hrc, hrc); 63 ComAssertRet (mData.vendorId, E_INVALIDARG); 64 65 hrc = aUSBDevice->COMGETTER(ProductId)(&unconst (mData.productId)); 66 ComAssertComRCRet (hrc, hrc); 67 ComAssertRet (mData.productId, E_INVALIDARG); 68 69 hrc = aUSBDevice->COMGETTER(Revision)(&unconst (mData.revision)); 70 ComAssertComRCRet (hrc, hrc); 71 72 hrc = aUSBDevice->COMGETTER(Manufacturer)(unconst (mData.manufacturer).asOutParam()); 73 ComAssertComRCRet (hrc, hrc); 74 75 hrc = aUSBDevice->COMGETTER(Product)(unconst (mData.product).asOutParam()); 76 ComAssertComRCRet (hrc, hrc); 77 78 hrc = aUSBDevice->COMGETTER(SerialNumber)(unconst (mData.serialNumber).asOutParam()); 79 ComAssertComRCRet (hrc, hrc); 80 81 hrc = aUSBDevice->COMGETTER(Address)(unconst (mData.address).asOutParam()); 82 ComAssertComRCRet (hrc, hrc); 83 84 hrc = aUSBDevice->COMGETTER(Port)(&unconst (mData.port)); 85 ComAssertComRCRet (hrc, hrc); 86 87 hrc = aUSBDevice->COMGETTER(Port)(&unconst (mData.version)); 88 ComAssertComRCRet (hrc, hrc); 89 90 hrc = aUSBDevice->COMGETTER(Port)(&unconst (mData.portVersion)); 91 ComAssertComRCRet (hrc, hrc); 92 93 hrc = aUSBDevice->COMGETTER(Remote)(&unconst (mData.remote)); 94 ComAssertComRCRet (hrc, hrc); 95 96 hrc = aUSBDevice->COMGETTER(Id)(unconst (mData.id).asOutParam()); 97 ComAssertComRCRet (hrc, hrc); 98 99 /* Confirm a successful initialization */ 100 autoInitSpan.setSucceeded(); 101 102 return S_OK; 103 } 104 105 /** 106 * Uninitializes the instance and sets the ready flag to FALSE. 107 * Called either from FinalRelease() or by the parent when it gets destroyed. 108 */ 109 void OUSBDevice::uninit() 110 { 111 LogFlowThisFunc (("\n")); 112 113 /* Enclose the state transition Ready->InUninit->NotReady */ 114 AutoUninitSpan autoUninitSpan (this); 115 if (autoUninitSpan.uninitDone()) 116 return; 117 118 unconst (mData.id).clear(); 119 120 unconst (mData.vendorId) = 0; 121 unconst (mData.productId) = 0; 122 unconst (mData.revision) = 0; 123 124 unconst (mData.manufacturer).setNull(); 125 unconst (mData.product).setNull(); 126 unconst (mData.serialNumber).setNull(); 127 128 unconst (mData.address).setNull(); 129 130 unconst (mData.port) = 0; 131 unconst (mData.version) = 1; 132 unconst (mData.portVersion) = 1; 133 134 unconst (mData.remote) = FALSE; 135 } 100 136 101 137 // IUSBDevice properties … … 113 149 return E_POINTER; 114 150 115 AutoWriteLock alock (this); 116 CHECK_READY(); 117 118 mId.cloneTo(aId); 151 AutoCaller autoCaller (this); 152 CheckComRCReturnRC (autoCaller.rc()); 153 154 /* this is const, no need to lock */ 155 mData.id.cloneTo (aId); 156 119 157 return S_OK; 120 158 } … … 132 170 return E_POINTER; 133 171 134 AutoWriteLock alock (this); 135 CHECK_READY(); 136 137 *aVendorId = mVendorId; 172 AutoCaller autoCaller (this); 173 CheckComRCReturnRC (autoCaller.rc()); 174 175 /* this is const, no need to lock */ 176 *aVendorId = mData.vendorId; 177 138 178 return S_OK; 139 179 } … … 151 191 return E_POINTER; 152 192 153 AutoWriteLock alock (this); 154 CHECK_READY(); 155 156 *aProductId = mProductId; 193 AutoCaller autoCaller (this); 194 CheckComRCReturnRC (autoCaller.rc()); 195 196 /* this is const, no need to lock */ 197 *aProductId = mData.productId; 198 157 199 return S_OK; 158 200 } … … 170 212 return E_POINTER; 171 213 172 AutoWriteLock alock (this); 173 CHECK_READY(); 174 175 *aRevision = mRevision; 214 AutoCaller autoCaller (this); 215 CheckComRCReturnRC (autoCaller.rc()); 216 217 /* this is const, no need to lock */ 218 *aRevision = mData.revision; 219 176 220 return S_OK; 177 221 } … … 188 232 return E_POINTER; 189 233 190 AutoWriteLock alock (this); 191 CHECK_READY(); 192 193 mManufacturer.cloneTo(aManufacturer); 234 AutoCaller autoCaller (this); 235 CheckComRCReturnRC (autoCaller.rc()); 236 237 /* this is const, no need to lock */ 238 mData.manufacturer.cloneTo (aManufacturer); 239 194 240 return S_OK; 195 241 } … … 207 253 return E_POINTER; 208 254 209 AutoWriteLock alock (this); 210 CHECK_READY(); 211 212 mProduct.cloneTo(aProduct); 255 AutoCaller autoCaller (this); 256 CheckComRCReturnRC (autoCaller.rc()); 257 258 /* this is const, no need to lock */ 259 mData.product.cloneTo (aProduct); 260 213 261 return S_OK; 214 262 } … … 226 274 return E_POINTER; 227 275 228 AutoWriteLock alock (this); 229 CHECK_READY(); 230 231 mSerialNumber.cloneTo(aSerialNumber); 276 AutoCaller autoCaller (this); 277 CheckComRCReturnRC (autoCaller.rc()); 278 279 /* this is const, no need to lock */ 280 mData.serialNumber.cloneTo (aSerialNumber); 281 232 282 return S_OK; 233 283 } … … 245 295 return E_POINTER; 246 296 247 AutoWriteLock alock (this); 248 CHECK_READY(); 249 250 mAddress.cloneTo(aAddress); 297 AutoCaller autoCaller (this); 298 CheckComRCReturnRC (autoCaller.rc()); 299 300 /* this is const, no need to lock */ 301 mData.address.cloneTo (aAddress); 302 251 303 return S_OK; 252 304 } … … 257 309 return E_POINTER; 258 310 259 AutoWriteLock alock (this); 260 CHECK_READY(); 261 262 *aPort = mPort; 311 AutoCaller autoCaller (this); 312 CheckComRCReturnRC (autoCaller.rc()); 313 314 /* this is const, no need to lock */ 315 *aPort = mData.port; 316 263 317 return S_OK; 264 318 } … … 269 323 return E_POINTER; 270 324 271 AutoWriteLock alock (this); 272 CHECK_READY(); 273 274 *aVersion = mVersion; 325 AutoCaller autoCaller (this); 326 CheckComRCReturnRC (autoCaller.rc()); 327 328 /* this is const, no need to lock */ 329 *aVersion = mData.version; 330 275 331 return S_OK; 276 332 } … … 281 337 return E_POINTER; 282 338 283 AutoWriteLock alock (this); 284 CHECK_READY(); 285 286 *aPortVersion = mPortVersion; 339 AutoCaller autoCaller (this); 340 CheckComRCReturnRC (autoCaller.rc()); 341 342 /* this is const, no need to lock */ 343 *aPortVersion = mData.portVersion; 344 287 345 return S_OK; 288 346 } … … 293 351 return E_POINTER; 294 352 295 AutoWriteLock alock (this); 296 CHECK_READY(); 297 298 *aRemote = mRemote; 353 AutoCaller autoCaller (this); 354 CheckComRCReturnRC (autoCaller.rc()); 355 356 /* this is const, no need to lock */ 357 *aRemote = mData.remote; 358 299 359 return S_OK; 300 360 } -
trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h
r8155 r13659 1 /* $Id$ */ 2 1 3 /** @file 2 4 * … … 6 8 7 9 /* 8 * Copyright (C) 2006-200 7Sun Microsystems, Inc.10 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 9 11 * 10 12 * This file is part of VirtualBox Open Source Edition (OSE), as … … 26 28 #include "VirtualBoxBase.h" 27 29 #include "Collection.h" 28 #include <VBox/vrdpapi.h> 30 31 struct _VRDPUSBDEVICEDESC; 32 typedef _VRDPUSBDEVICEDESC VRDPUSBDEVICEDESC; 29 33 30 34 class ATL_NO_VTABLE RemoteUSBDevice : 35 public VirtualBoxBaseNEXT, 31 36 public VirtualBoxSupportErrorInfoImpl <RemoteUSBDevice, IHostUSBDevice>, 32 37 public VirtualBoxSupportTranslation <RemoteUSBDevice>, 33 public VirtualBoxBase,34 38 public IHostUSBDevice 35 39 { 36 40 public: 37 41 38 DECLARE_NOT_AGGREGATABLE(RemoteUSBDevice) 42 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (OUSBDevice) 43 44 DECLARE_NOT_AGGREGATABLE (RemoteUSBDevice) 39 45 40 46 DECLARE_PROTECT_FINAL_CONSTRUCT() 41 47 42 BEGIN_COM_MAP (RemoteUSBDevice)43 COM_INTERFACE_ENTRY (ISupportErrorInfo)44 COM_INTERFACE_ENTRY (IHostUSBDevice)45 COM_INTERFACE_ENTRY (IUSBDevice)48 BEGIN_COM_MAP (RemoteUSBDevice) 49 COM_INTERFACE_ENTRY (ISupportErrorInfo) 50 COM_INTERFACE_ENTRY (IHostUSBDevice) 51 COM_INTERFACE_ENTRY (IUSBDevice) 46 52 END_COM_MAP() 47 53 … … 75 81 76 82 // public methods only for internal purposes 77 bool dirty (void) { return mDirty; }78 void dirty (bool aDirty) { mD irty = aDirty; }79 80 uint16_t devId (void) { return mDevId; }81 uint32_t clientId (void) { return m ClientId; }82 83 bool captured (void) { return mState == USBDeviceState_Captured; }83 bool dirty (void) const { return mData.dirty; } 84 void dirty (bool aDirty) { mData.dirty = aDirty; } 85 86 uint16_t devId (void) const { return mData.devId; } 87 uint32_t clientId (void) { return mData.clientId; } 88 89 bool captured (void) const { return mData.state == USBDeviceState_Captured; } 84 90 void captured (bool aCaptured) 85 91 { 86 92 if (aCaptured) 87 93 { 88 Assert(m State == USBDeviceState_Available);89 m State = USBDeviceState_Captured;94 Assert(mData.state == USBDeviceState_Available); 95 mData.state = USBDeviceState_Captured; 90 96 } 91 97 else 92 98 { 93 Assert(m State == USBDeviceState_Captured);94 m State = USBDeviceState_Available;99 Assert(mData.state == USBDeviceState_Captured); 100 mData.state = USBDeviceState_Available; 95 101 } 96 102 } … … 101 107 private: 102 108 103 Guid mId; 104 105 uint16_t mVendorId; 106 uint16_t mProductId; 107 uint16_t mRevision; 108 109 Bstr mManufacturer; 110 Bstr mProduct; 111 Bstr mSerialNumber; 112 113 Bstr mAddress; 114 115 uint16_t mPort; 116 uint16_t mVersion; 117 uint16_t mPortVersion; 118 119 USBDeviceState_T mState; 120 121 bool mDirty; 122 uint16_t mDevId; 123 uint32_t mClientId; 109 struct Data 110 { 111 Data() : vendorId (0), productId (0), revision (0), port (0), version (1), 112 portVersion (1), dirty (FALSE), devId (0), clientId (0) {} 113 114 const Guid id; 115 116 const uint16_t vendorId; 117 const uint16_t productId; 118 const uint16_t revision; 119 120 const Bstr manufacturer; 121 const Bstr product; 122 const Bstr serialNumber; 123 124 const Bstr address; 125 126 const uint16_t port; 127 const uint16_t version; 128 const uint16_t portVersion; 129 130 USBDeviceState_T state; 131 bool dirty; 132 133 const uint16_t devId; 134 const uint32_t clientId; 135 }; 136 137 Data mData; 124 138 }; 125 139 -
trunk/src/VBox/Main/include/USBDeviceImpl.h
r8721 r13659 1 /* $Id$ */ 2 1 3 /** @file 2 4 * Header file for the OUSBDevice (IUSBDevice) class, VBoxC. … … 4 6 5 7 /* 6 * Copyright (C) 2006-200 7Sun Microsystems, Inc.8 * Copyright (C) 2006-2008 Sun Microsystems, Inc. 7 9 * 8 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 32 34 */ 33 35 class ATL_NO_VTABLE OUSBDevice : 36 public VirtualBoxBaseNEXT, 34 37 public VirtualBoxSupportErrorInfoImpl<OUSBDevice, IUSBDevice>, 35 38 public VirtualBoxSupportTranslation<OUSBDevice>, 36 public VirtualBoxBase,37 39 public IUSBDevice 38 40 { 39 41 public: 40 42 41 OUSBDevice(); 42 virtual ~OUSBDevice(); 43 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (OUSBDevice) 43 44 44 45 DECLARE_NOT_AGGREGATABLE(OUSBDevice) … … 47 48 48 49 BEGIN_COM_MAP(OUSBDevice) 49 COM_INTERFACE_ENTRY (ISupportErrorInfo)50 COM_INTERFACE_ENTRY (IUSBDevice)50 COM_INTERFACE_ENTRY (ISupportErrorInfo) 51 COM_INTERFACE_ENTRY (IUSBDevice) 51 52 END_COM_MAP() 52 53 53 54 NS_DECL_ISUPPORTS 54 55 56 DECLARE_EMPTY_CTOR_DTOR (OUSBDevice) 57 58 HRESULT FinalConstruct(); 59 void FinalRelease(); 60 55 61 // public initializer/uninitializer for internal purposes only 56 HRESULT init(IUSBDevice *a_pUSBDevice); 62 HRESULT init (IUSBDevice *a_pUSBDevice); 63 void uninit(); 57 64 58 65 // IUSBDevice properties … … 71 78 72 79 // public methods only for internal purposes 73 const Guid &id() { return mId; }80 const Guid &id() const { return mData.id; } 74 81 75 82 // for VirtualBoxSupportErrorInfoImpl … … 77 84 78 85 private: 79 /** The UUID of this device. */80 Guid mId;81 86 82 /** The vendor id of this USB device. */ 83 USHORT mVendorId; 84 /** The product id of this USB device. */ 85 USHORT mProductId; 86 /** The product revision number of this USB device. 87 * (high byte = integer; low byte = decimal) */ 88 USHORT mRevision; 89 /** The Manufacturer string. (Quite possibly NULL.) */ 90 Bstr mManufacturer; 91 /** The Product string. (Quite possibly NULL.) */ 92 Bstr mProduct; 93 /** The SerialNumber string. (Quite possibly NULL.) */ 94 Bstr mSerialNumber; 95 /** The host specific address of the device. */ 96 Bstr mAddress; 97 /** The host port number. */ 98 USHORT mPort; 99 /** The major USB version number of the device. */ 100 USHORT mVersion; 101 /** The major USB version number of the port the device is attached to. */ 102 USHORT mPortVersion; 103 /** Remote (VRDP) or local device. */ 104 BOOL mRemote; 87 struct Data 88 { 89 Data() : vendorId (0), productId (0), revision (0), port (0), 90 version (1), portVersion (1), remote (FALSE) {} 91 92 /** The UUID of this device. */ 93 const Guid id; 94 95 /** The vendor id of this USB device. */ 96 const USHORT vendorId; 97 /** The product id of this USB device. */ 98 const USHORT productId; 99 /** The product revision number of this USB device. 100 * (high byte = integer; low byte = decimal) */ 101 const USHORT revision; 102 /** The Manufacturer string. (Quite possibly NULL.) */ 103 const Bstr manufacturer; 104 /** The Product string. (Quite possibly NULL.) */ 105 const Bstr product; 106 /** The SerialNumber string. (Quite possibly NULL.) */ 107 const Bstr serialNumber; 108 /** The host specific address of the device. */ 109 const Bstr address; 110 /** The host port number. */ 111 const USHORT port; 112 /** The major USB version number of the device. */ 113 const USHORT version; 114 /** The major USB version number of the port the device is attached to. */ 115 const USHORT portVersion; 116 /** Remote (VRDP) or local device. */ 117 const BOOL remote; 118 }; 119 120 Data mData; 105 121 }; 106 122
Note:
See TracChangeset
for help on using the changeset viewer.