Changeset 56584 in vbox
- Timestamp:
- Jun 22, 2015 5:10:24 PM (9 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
-
include/RemoteUSBDeviceImpl.h (modified) (6 diffs)
-
include/USBDeviceImpl.h (modified) (4 diffs)
-
src-client/RemoteUSBDeviceImpl.cpp (modified) (13 diffs)
-
src-client/xpcom/module.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h
r53297 r56584 8 8 9 9 /* 10 * Copyright (C) 2006-201 1Oracle Corporation10 * Copyright (C) 2006-2015 Oracle Corporation 11 11 * 12 12 * This file is part of VirtualBox Open Source Edition (OSE), as … … 22 22 #define ____H_REMOTEUSBDEVICEIMPL 23 23 24 #include " VirtualBoxBase.h"24 #include "HostUSBDeviceWrap.h" 25 25 26 26 struct _VRDEUSBDEVICEDESC; … … 28 28 29 29 class ATL_NO_VTABLE RemoteUSBDevice : 30 public VirtualBoxBase, 31 VBOX_SCRIPTABLE_IMPL(IHostUSBDevice) 30 public HostUSBDeviceWrap 32 31 { 33 32 public: 34 33 35 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(RemoteUSBDevice, IHostUSBDevice) 36 37 DECLARE_NOT_AGGREGATABLE (RemoteUSBDevice) 38 39 DECLARE_PROTECT_FINAL_CONSTRUCT() 40 41 BEGIN_COM_MAP (RemoteUSBDevice) 42 COM_INTERFACE_ENTRY (IHostUSBDevice) 43 VBOX_DEFAULT_INTERFACE_ENTRIES (IUSBDevice) 44 END_COM_MAP() 45 46 DECLARE_EMPTY_CTOR_DTOR (RemoteUSBDevice) 34 DECLARE_EMPTY_CTOR_DTOR(RemoteUSBDevice) 47 35 48 36 HRESULT FinalConstruct(); … … 53 41 void uninit(); 54 42 55 // IUSBDevice properties 56 STDMETHOD(COMGETTER(Id)) (BSTR *aId); 57 STDMETHOD(COMGETTER(VendorId)) (USHORT *aVendorId); 58 STDMETHOD(COMGETTER(ProductId)) (USHORT *aProductId); 59 STDMETHOD(COMGETTER(Revision)) (USHORT *aRevision); 60 STDMETHOD(COMGETTER(Manufacturer)) (BSTR *aManufacturer); 61 STDMETHOD(COMGETTER(Product)) (BSTR *aProduct); 62 STDMETHOD(COMGETTER(SerialNumber)) (BSTR *aSerialNumber); 63 STDMETHOD(COMGETTER(Address)) (BSTR *aAddress); 64 STDMETHOD(COMGETTER(Port)) (USHORT *aPort); 65 STDMETHOD(COMGETTER(Version)) (USHORT *aVersion); 66 STDMETHOD(COMGETTER(PortVersion)) (USHORT *aPortVersion); 67 STDMETHOD(COMGETTER(Speed)) (USBConnectionSpeed_T *aSpeed); 68 STDMETHOD(COMGETTER(Remote)) (BOOL *aRemote); 43 // public methods only for internal purposes 44 bool dirty(void) const { return mData.dirty; } 45 void dirty(bool aDirty) { mData.dirty = aDirty; } 69 46 70 // IHostUSBDevice properties71 STDMETHOD(COMGETTER(State)) (USBDeviceState_T *aState);47 uint16_t devId(void) const { return mData.devId; } 48 uint32_t clientId(void) { return mData.clientId; } 72 49 73 // public methods only for internal purposes 74 bool dirty (void) const { return mData.dirty; } 75 void dirty (bool aDirty) { mData.dirty = aDirty; } 76 77 uint16_t devId (void) const { return mData.devId; } 78 uint32_t clientId (void) { return mData.clientId; } 79 80 bool captured (void) const { return mData.state == USBDeviceState_Captured; } 81 void captured (bool aCaptured) 50 bool captured(void) const { return mData.state == USBDeviceState_Captured; } 51 void captured(bool aCaptured) 82 52 { 83 53 if (aCaptured) … … 95 65 private: 96 66 67 // wrapped IUSBDevice properties 68 HRESULT getId(com::Guid &aId); 69 HRESULT getVendorId(USHORT *aVendorId); 70 HRESULT getProductId(USHORT *aProductId); 71 HRESULT getRevision(USHORT *aRevision); 72 HRESULT getManufacturer(com::Utf8Str &aManufacturer); 73 HRESULT getProduct(com::Utf8Str &aProduct); 74 HRESULT getSerialNumber(com::Utf8Str &aSerialNumber); 75 HRESULT getAddress(com::Utf8Str &aAddress); 76 HRESULT getPort(USHORT *aPort); 77 HRESULT getVersion(USHORT *aVersion); 78 HRESULT getPortVersion(USHORT *aPortVersion); 79 HRESULT getSpeed(USBConnectionSpeed_T *aSpeed); 80 HRESULT getRemote(BOOL *aRemote); 81 82 // wrapped IHostUSBDevice properties 83 HRESULT getState(USBDeviceState_T *aState); 84 85 97 86 struct Data 98 87 { 99 Data() : vendorId (0), productId (0), revision (0), port (0), version (1), 100 portVersion (1), speed (USBConnectionSpeed_Null), dirty (FALSE), devId (0), clientId (0) {} 88 Data() : vendorId(0), productId(0), revision(0), port(0), version(1), 89 portVersion(1), speed(USBConnectionSpeed_Null), dirty(FALSE), 90 devId(0), clientId(0) {} 101 91 102 92 const Guid id; … … 106 96 const uint16_t revision; 107 97 108 const Bstr manufacturer;109 const Bstr product;110 const Bstr serialNumber;98 const Utf8Str manufacturer; 99 const Utf8Str product; 100 const Utf8Str serialNumber; 111 101 112 const Bstr address;102 const Utf8Str address; 113 103 114 104 const uint16_t port; -
trunk/src/VBox/Main/include/USBDeviceImpl.h
r53297 r56584 6 6 7 7 /* 8 * Copyright (C) 2006-201 1Oracle Corporation8 * Copyright (C) 2006-2015 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 31 31 public: 32 32 33 DECLARE_EMPTY_CTOR_DTOR (OUSBDevice)33 DECLARE_EMPTY_CTOR_DTOR(OUSBDevice) 34 34 35 35 HRESULT FinalConstruct(); … … 37 37 38 38 // public initializer/uninitializer for internal purposes only 39 HRESULT init (IUSBDevice *a_pUSBDevice);39 HRESULT init(IUSBDevice *a_pUSBDevice); 40 40 void uninit(); 41 41 … … 62 62 struct Data 63 63 { 64 Data() : vendorId (0), productId (0), revision (0), port (0), 65 version (1), portVersion (1), speed (USBConnectionSpeed_Null), remote (FALSE) {} 64 Data() : vendorId(0), productId(0), revision(0), port(0), 65 version(1), portVersion(1), speed(USBConnectionSpeed_Null), 66 remote(FALSE) {} 66 67 67 68 /** The UUID of this device. */ -
trunk/src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp
r53624 r56584 8 8 9 9 /* 10 * Copyright (C) 2006-201 1Oracle Corporation10 * Copyright (C) 2006-2015 Oracle Corporation 11 11 * 12 12 * This file is part of VirtualBox Open Source Edition (OSE), as … … 34 34 ///////////////////////////////////////////////////////////////////////////// 35 35 36 DEFINE_EMPTY_CTOR_DTOR (RemoteUSBDevice)36 DEFINE_EMPTY_CTOR_DTOR(RemoteUSBDevice) 37 37 38 38 HRESULT RemoteUSBDevice::FinalConstruct() … … 55 55 * Initializes the remote USB device object. 56 56 */ 57 HRESULT RemoteUSBDevice::init (uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevDesc, bool fDescExt)57 HRESULT RemoteUSBDevice::init(uint32_t u32ClientId, VRDEUSBDEVICEDESC *pDevDesc, bool fDescExt) 58 58 { 59 59 LogFlowThisFunc(("u32ClientId=%d,pDevDesc=%p\n", u32ClientId, pDevDesc)); … … 69 69 unconst(mData.revision) = pDevDesc->bcdRev; 70 70 71 unconst(mData.manufacturer) = pDevDesc->oManufacturer ? (char *)pDevDesc + pDevDesc->oManufacturer: "";72 unconst(mData.product) = pDevDesc->oProduct ? (char *)pDevDesc + pDevDesc->oProduct: "";73 unconst(mData.serialNumber) = pDevDesc->oSerialNumber ? (char *)pDevDesc + pDevDesc->oSerialNumber: "";71 unconst(mData.manufacturer) = pDevDesc->oManufacturer ? (char *)pDevDesc + pDevDesc->oManufacturer : ""; 72 unconst(mData.product) = pDevDesc->oProduct ? (char *)pDevDesc + pDevDesc->oProduct : ""; 73 unconst(mData.serialNumber) = pDevDesc->oSerialNumber ? (char *)pDevDesc + pDevDesc->oSerialNumber : ""; 74 74 75 75 char id[64]; 76 RTStrPrintf(id, sizeof (id), REMOTE_USB_BACKEND_PREFIX_S "0x%08X&0x%08X", pDevDesc->id, u32ClientId);76 RTStrPrintf(id, sizeof(id), REMOTE_USB_BACKEND_PREFIX_S "0x%08X&0x%08X", pDevDesc->id, u32ClientId); 77 77 unconst(mData.address) = id; 78 78 … … 165 165 ///////////////////////////////////////////////////////////////////////////// 166 166 167 STDMETHODIMP RemoteUSBDevice::COMGETTER(Id) (BSTR *aId) 168 { 169 CheckComArgOutPointerValid(aId); 170 171 AutoCaller autoCaller(this); 172 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 173 174 /* this is const, no need to lock */ 175 mData.id.toUtf16().detachTo(aId); 176 177 return S_OK; 178 } 179 180 STDMETHODIMP RemoteUSBDevice::COMGETTER(VendorId) (USHORT *aVendorId) 181 { 182 CheckComArgOutPointerValid(aVendorId); 183 184 AutoCaller autoCaller(this); 185 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 186 167 HRESULT RemoteUSBDevice::getId(com::Guid &aId) 168 { 169 aId = mData.id; 170 171 return S_OK; 172 } 173 174 HRESULT RemoteUSBDevice::getVendorId(USHORT *aVendorId) 175 { 187 176 /* this is const, no need to lock */ 188 177 *aVendorId = mData.vendorId; … … 191 180 } 192 181 193 STDMETHODIMP RemoteUSBDevice::COMGETTER(ProductId) (USHORT *aProductId) 194 { 195 CheckComArgOutPointerValid(aProductId); 196 197 AutoCaller autoCaller(this); 198 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 199 182 HRESULT RemoteUSBDevice::getProductId(USHORT *aProductId) 183 { 200 184 /* this is const, no need to lock */ 201 185 *aProductId = mData.productId; … … 204 188 } 205 189 206 STDMETHODIMP RemoteUSBDevice::COMGETTER(Revision) (USHORT *aRevision) 207 { 208 CheckComArgOutPointerValid(aRevision); 209 210 AutoCaller autoCaller(this); 211 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 212 190 HRESULT RemoteUSBDevice::getRevision(USHORT *aRevision) 191 { 213 192 /* this is const, no need to lock */ 214 193 *aRevision = mData.revision; … … 217 196 } 218 197 219 STDMETHODIMP RemoteUSBDevice::COMGETTER(Manufacturer) (BSTR *aManufacturer) 220 { 221 CheckComArgOutPointerValid(aManufacturer); 222 223 AutoCaller autoCaller(this); 224 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 225 226 /* this is const, no need to lock */ 227 mData.manufacturer.cloneTo(aManufacturer); 228 229 return S_OK; 230 } 231 232 STDMETHODIMP RemoteUSBDevice::COMGETTER(Product) (BSTR *aProduct) 233 { 234 CheckComArgOutPointerValid(aProduct); 235 236 AutoCaller autoCaller(this); 237 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 238 239 /* this is const, no need to lock */ 240 mData.product.cloneTo(aProduct); 241 242 return S_OK; 243 } 244 245 STDMETHODIMP RemoteUSBDevice::COMGETTER(SerialNumber) (BSTR *aSerialNumber) 246 { 247 CheckComArgOutPointerValid(aSerialNumber); 248 249 AutoCaller autoCaller(this); 250 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 251 252 /* this is const, no need to lock */ 253 mData.serialNumber.cloneTo(aSerialNumber); 254 255 return S_OK; 256 } 257 258 STDMETHODIMP RemoteUSBDevice::COMGETTER(Address) (BSTR *aAddress) 259 { 260 CheckComArgOutPointerValid(aAddress); 261 262 AutoCaller autoCaller(this); 263 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 264 265 /* this is const, no need to lock */ 266 mData.address.cloneTo(aAddress); 267 268 return S_OK; 269 } 270 271 STDMETHODIMP RemoteUSBDevice::COMGETTER(Port) (USHORT *aPort) 272 { 273 CheckComArgOutPointerValid(aPort); 274 275 AutoCaller autoCaller(this); 276 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 277 198 HRESULT RemoteUSBDevice::getManufacturer(com::Utf8Str &aManufacturer) 199 { 200 /* this is const, no need to lock */ 201 aManufacturer = mData.manufacturer; 202 203 return S_OK; 204 } 205 206 HRESULT RemoteUSBDevice::getProduct(com::Utf8Str &aProduct) 207 { 208 /* this is const, no need to lock */ 209 aProduct = mData.product; 210 211 return S_OK; 212 } 213 214 HRESULT RemoteUSBDevice::getSerialNumber(com::Utf8Str &aSerialNumber) 215 { 216 /* this is const, no need to lock */ 217 aSerialNumber = mData.serialNumber; 218 219 return S_OK; 220 } 221 222 HRESULT RemoteUSBDevice::getAddress(com::Utf8Str &aAddress) 223 { 224 /* this is const, no need to lock */ 225 aAddress = mData.address; 226 227 return S_OK; 228 } 229 230 HRESULT RemoteUSBDevice::getPort(USHORT *aPort) 231 { 278 232 /* this is const, no need to lock */ 279 233 *aPort = mData.port; … … 282 236 } 283 237 284 STDMETHODIMP RemoteUSBDevice::COMGETTER(Version) (USHORT *aVersion) 285 { 286 CheckComArgOutPointerValid(aVersion); 287 288 AutoCaller autoCaller(this); 289 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 290 238 HRESULT RemoteUSBDevice::getVersion(USHORT *aVersion) 239 { 291 240 /* this is const, no need to lock */ 292 241 *aVersion = mData.version; … … 295 244 } 296 245 297 STDMETHODIMP RemoteUSBDevice::COMGETTER(PortVersion) (USHORT *aPortVersion) 298 { 299 CheckComArgOutPointerValid(aPortVersion); 300 301 AutoCaller autoCaller(this); 302 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 303 246 HRESULT RemoteUSBDevice::getPortVersion(USHORT *aPortVersion) 247 { 304 248 /* this is const, no need to lock */ 305 249 *aPortVersion = mData.portVersion; … … 308 252 } 309 253 310 STDMETHODIMP RemoteUSBDevice::COMGETTER(Speed) (USBConnectionSpeed_T *aSpeed) 311 { 312 CheckComArgOutPointerValid(aSpeed); 313 314 AutoCaller autoCaller(this); 315 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 316 254 HRESULT RemoteUSBDevice::getSpeed(USBConnectionSpeed_T *aSpeed) 255 { 317 256 /* this is const, no need to lock */ 318 257 *aSpeed = mData.speed; … … 321 260 } 322 261 323 STDMETHODIMP RemoteUSBDevice::COMGETTER(Remote) (BOOL *aRemote) 324 { 325 CheckComArgOutPointerValid(aRemote); 326 327 AutoCaller autoCaller(this); 328 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 329 262 HRESULT RemoteUSBDevice::getRemote(BOOL *aRemote) 263 { 330 264 /* RemoteUSBDevice is always remote. */ 331 265 /* this is const, no need to lock */ … … 338 272 //////////////////////////////////////////////////////////////////////////////// 339 273 340 STDMETHODIMP RemoteUSBDevice::COMGETTER(State) (USBDeviceState_T *aState) 341 { 342 CheckComArgOutPointerValid(aState); 343 344 AutoCaller autoCaller(this); 345 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 346 274 HRESULT RemoteUSBDevice::getState(USBDeviceState_T *aState) 275 { 347 276 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 348 277 -
trunk/src/VBox/Main/src-client/xpcom/module.cpp
r55401 r56584 6 6 7 7 /* 8 * Copyright (C) 2006-201 4Oracle Corporation8 * Copyright (C) 2006-2015 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 38 38 39 39 // XPCOM glue code unfolding 40 41 #ifndef VBOX_COM_INPROC_API_CLIENT42 NS_DECL_CLASSINFO(RemoteUSBDevice)43 NS_IMPL_THREADSAFE_ISUPPORTS2_CI(RemoteUSBDevice, IHostUSBDevice, IUSBDevice)44 #endif /* VBOX_COM_INPROC_API_CLIENT */45 40 46 41 /*
Note:
See TracChangeset
for help on using the changeset viewer.

