deviceEventManager.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef _NULLSOFT_WINAMP_DEVICES_DEVICE_EVENT_MANAGER_HEADER
  2. #define _NULLSOFT_WINAMP_DEVICES_DEVICE_EVENT_MANAGER_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include "./ifc_deviceevent.h"
  7. #include "./ifc_deviceeventmanager.h"
  8. #include <vector>
  9. class DeviceEventManager : public ifc_deviceeventmanager
  10. {
  11. protected:
  12. DeviceEventManager();
  13. ~DeviceEventManager();
  14. public:
  15. static HRESULT CreateInstance(DeviceEventManager **instance);
  16. public:
  17. /* Dispatchable */
  18. size_t AddRef();
  19. size_t Release();
  20. int QueryInterface(GUID interface_guid, void **object);
  21. /* ifc_deviceeventmanager */
  22. HRESULT Advise(ifc_deviceevent *handler);
  23. HRESULT Unadvise(ifc_deviceevent *handler);
  24. void Notify_IconChanged(ifc_device *device);
  25. void Notify_DisplayNameChanged(ifc_device *device, const wchar_t *displayName);
  26. void Notify_AttachmentChanged(ifc_device *device, BOOL attached);
  27. void Notify_VisibilityChanged(ifc_device *device, BOOL visible);
  28. void Notify_TotalSpaceChanged(ifc_device *device, uint64_t space);
  29. void Notify_UsedSpaceChanged(ifc_device *device, uint64_t space);
  30. void Notfiy_CommandChanged(ifc_device *device);
  31. void Notify_ActivityStarted(ifc_device *device, ifc_deviceactivity *activity);
  32. void Notify_ActivityFinished(ifc_device *device, ifc_deviceactivity *activity);
  33. void Notify_ActivityChanged(ifc_device *device, ifc_deviceactivity *activity);
  34. void Notify_ModelChanged(ifc_device *device, const wchar_t *model);
  35. void Notify_StatusChanged(ifc_device *device, const wchar_t *status);
  36. public:
  37. void Lock();
  38. void Unlock();
  39. protected:
  40. typedef std::vector<ifc_deviceevent*> HandlerList;
  41. protected:
  42. size_t ref;
  43. HandlerList handlerList;
  44. CRITICAL_SECTION lock;
  45. protected:
  46. RECVS_DISPATCH;
  47. };
  48. #endif // _NULLSOFT_WINAMP_DEVICES_DEVICE_EVENT_MANAGER_HEADER