- Timestamp:
- Jul 13, 2011 3:54:30 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 72838
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r37906 r37928 16681 16681 <interface 16682 16682 name="IMachineDataChangedEvent" extends="IMachineEvent" 16683 uuid=" 6AA70A6C-0DCA-4810-8C5C-457B278E3D49"16683 uuid="abe94809-2e88-4436-83d7-50f3e64d0503" 16684 16684 wsmap="managed" autogen="VBoxEvent" id="OnMachineDataChanged" 16685 16685 > … … 16687 16687 Any of the settings of the given machine has changed. 16688 16688 </desc> 16689 16690 <attribute name="temporary" readonly="yes" type="boolean"> 16691 <desc>@c true if the settings change is temporary. All permanent 16692 settings changes will trigger an event, and only temporary settings 16693 changes for running VMs will trigger an event. Note: sending events 16694 for temporary changes is NOT IMPLEMENTED.</desc> 16695 </attribute> 16689 16696 </interface> 16690 16697 -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r37779 r37928 193 193 194 194 void onMachineStateChange(const Guid &aId, MachineState_T aState); 195 void onMachineDataChange(const Guid &aId );195 void onMachineDataChange(const Guid &aId, BOOL aTemporary = FALSE); 196 196 BOOL onExtraDataCanChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue, 197 197 Bstr &aError); -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r37779 r37928 109 109 //////////////////////////////////////////////////////////////////////////////// 110 110 // 111 // VirtualBoxCallbackRegistration112 //113 ////////////////////////////////////////////////////////////////////////////////114 115 /**116 * Registered IVirtualBoxCallback, used by VirtualBox::CallbackList and117 * VirtualBox::Data::llCallbacks.118 *119 * In addition to keeping the interface pointer this also keeps track of the120 * methods that asked to not be called again. The latter is for reducing121 * unnecessary IPC.122 */123 class VirtualBoxCallbackRegistration124 {125 public:126 /** Callback bit indexes (for bmDisabled). */127 typedef enum128 {129 kOnMachineStateChanged = 0,130 kOnMachineDataChanged,131 kOnExtraDataCanChange,132 kOnExtraDataChanged,133 kOnMediumRegistered,134 kOnMachineRegistered,135 kOnSessionStateChanged,136 kOnSnapshotTaken,137 kOnSnapshotDeleted,138 kOnSnapshotChanged,139 kOnGuestPropertyChanged140 } CallbackBit;141 142 VirtualBoxCallbackRegistration()143 {144 /* nothing */145 }146 147 ~VirtualBoxCallbackRegistration()148 {149 /* nothing */150 }151 };152 153 ////////////////////////////////////////////////////////////////////////////////154 //155 111 // CallbackEvent class 156 112 // … … 171 127 public: 172 128 173 CallbackEvent(VirtualBox *aVirtualBox, V irtualBoxCallbackRegistration::CallbackBitaWhat)129 CallbackEvent(VirtualBox *aVirtualBox, VBoxEventType_T aWhat) 174 130 : mVirtualBox(aVirtualBox), mWhat(aWhat) 175 131 { … … 187 143 * is bound to the lifetime of the VirtualBox instance, so it's safe. 188 144 */ 189 VirtualBox *mVirtualBox;145 VirtualBox *mVirtualBox; 190 146 protected: 191 V irtualBoxCallbackRegistration::CallbackBitmWhat;147 VBoxEventType_T mWhat; 192 148 }; 193 149 … … 2360 2316 struct MachineEvent : public VirtualBox::CallbackEvent 2361 2317 { 2362 MachineEvent(VirtualBox *aVB, const Guid &aId) 2363 : CallbackEvent(aVB, VirtualBoxCallbackRegistration::kOnMachineDataChanged), id(aId.toUtf16()) 2318 MachineEvent(VirtualBox *aVB, VBoxEventType_T aWhat, const Guid &aId, BOOL aBool) 2319 : CallbackEvent(aVB, aWhat), id(aId.toUtf16()) 2320 , mBool(aBool) 2321 { } 2322 2323 MachineEvent(VirtualBox *aVB, VBoxEventType_T aWhat, const Guid &aId, MachineState_T aState) 2324 : CallbackEvent(aVB, aWhat), id(aId.toUtf16()) 2325 , mState(aState) 2364 2326 {} 2365 2327 2366 MachineEvent(VirtualBox *aVB, const Guid &aId, MachineState_T aState)2367 : CallbackEvent(aVB, VirtualBoxCallbackRegistration::kOnMachineStateChanged), id(aId.toUtf16())2368 , state(aState)2369 {}2370 2371 MachineEvent(VirtualBox *aVB, const Guid &aId, BOOL aRegistered)2372 : CallbackEvent(aVB, VirtualBoxCallbackRegistration::kOnMachineRegistered), id(aId.toUtf16())2373 , registered(aRegistered)2374 {}2375 2376 2328 virtual HRESULT prepareEventDesc(IEventSource* aSource, VBoxEventDesc& aEvDesc) 2377 2329 { 2378 2330 switch (mWhat) 2379 2331 { 2380 case V irtualBoxCallbackRegistration::kOnMachineDataChanged:2381 aEvDesc.init(aSource, VBoxEventType_OnMachineDataChanged, id.raw());2332 case VBoxEventType_OnMachineDataChanged: 2333 aEvDesc.init(aSource, mWhat, id.raw(), mBool); 2382 2334 break; 2383 2335 2384 case V irtualBoxCallbackRegistration::kOnMachineStateChanged:2385 aEvDesc.init(aSource, VBoxEventType_OnMachineStateChanged, id.raw(), state);2336 case VBoxEventType_OnMachineStateChanged: 2337 aEvDesc.init(aSource, mWhat, id.raw(), mState); 2386 2338 break; 2387 2339 2388 case V irtualBoxCallbackRegistration::kOnMachineRegistered:2389 aEvDesc.init(aSource, VBoxEventType_OnMachineRegistered, id.raw(), registered);2340 case VBoxEventType_OnMachineRegistered: 2341 aEvDesc.init(aSource, mWhat, id.raw(), mBool); 2390 2342 break; 2391 2343 … … 2397 2349 2398 2350 Bstr id; 2399 MachineState_T state;2400 BOOL registered;2351 MachineState_T mState; 2352 BOOL mBool; 2401 2353 }; 2402 2354 … … 2406 2358 void VirtualBox::onMachineStateChange(const Guid &aId, MachineState_T aState) 2407 2359 { 2408 postEvent(new MachineEvent(this, aId, aState));2360 postEvent(new MachineEvent(this, VBoxEventType_OnMachineStateChanged, aId, aState)); 2409 2361 } 2410 2362 … … 2412 2364 * @note Doesn't lock any object. 2413 2365 */ 2414 void VirtualBox::onMachineDataChange(const Guid &aId )2415 { 2416 postEvent(new MachineEvent(this, aId));2366 void VirtualBox::onMachineDataChange(const Guid &aId, BOOL aTemporary) 2367 { 2368 postEvent(new MachineEvent(this, VBoxEventType_OnMachineDataChanged, aId, aTemporary)); 2417 2369 } 2418 2370 … … 2466 2418 ExtraDataEvent(VirtualBox *aVB, const Guid &aMachineId, 2467 2419 IN_BSTR aKey, IN_BSTR aVal) 2468 : CallbackEvent(aVB, V irtualBoxCallbackRegistration::kOnExtraDataChanged)2420 : CallbackEvent(aVB, VBoxEventType_OnExtraDataChanged) 2469 2421 , machineId(aMachineId.toUtf16()), key(aKey), val(aVal) 2470 2422 {} … … 2491 2443 void VirtualBox::onMachineRegistered(const Guid &aId, BOOL aRegistered) 2492 2444 { 2493 postEvent(new MachineEvent(this, aId, aRegistered));2445 postEvent(new MachineEvent(this, VBoxEventType_OnMachineRegistered, aId, aRegistered)); 2494 2446 } 2495 2447 … … 2498 2450 { 2499 2451 SessionEvent(VirtualBox *aVB, const Guid &aMachineId, SessionState_T aState) 2500 : CallbackEvent(aVB, V irtualBoxCallbackRegistration::kOnSessionStateChanged)2452 : CallbackEvent(aVB, VBoxEventType_OnSessionStateChanged) 2501 2453 , machineId(aMachineId.toUtf16()), sessionState(aState) 2502 2454 {} … … 2522 2474 { 2523 2475 SnapshotEvent(VirtualBox *aVB, const Guid &aMachineId, const Guid &aSnapshotId, 2524 V irtualBoxCallbackRegistration::CallbackBitaWhat)2476 VBoxEventType_T aWhat) 2525 2477 : CallbackEvent(aVB, aWhat) 2526 2478 , machineId(aMachineId), snapshotId(aSnapshotId) … … 2543 2495 { 2544 2496 postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, 2545 V irtualBoxCallbackRegistration::kOnSnapshotTaken));2497 VBoxEventType_OnSnapshotTaken)); 2546 2498 } 2547 2499 … … 2552 2504 { 2553 2505 postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, 2554 V irtualBoxCallbackRegistration::kOnSnapshotDeleted));2506 VBoxEventType_OnSnapshotDeleted)); 2555 2507 } 2556 2508 … … 2561 2513 { 2562 2514 postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, 2563 V irtualBoxCallbackRegistration::kOnSnapshotChanged));2515 VBoxEventType_OnSnapshotChanged)); 2564 2516 } 2565 2517 … … 2569 2521 GuestPropertyEvent(VirtualBox *aVBox, const Guid &aMachineId, 2570 2522 IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags) 2571 : CallbackEvent(aVBox, V irtualBoxCallbackRegistration::kOnGuestPropertyChanged),2523 : CallbackEvent(aVBox, VBoxEventType_OnGuestPropertyChanged), 2572 2524 machineId(aMachineId), 2573 2525 name(aName),
Note:
See TracChangeset
for help on using the changeset viewer.