1
0

ifc_device.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #ifndef _NULLSOFT_WINAMP_DEVICES_DEVICE_INTERFACE_HEADER
  2. #define _NULLSOFT_WINAMP_DEVICES_DEVICE_INTERFACE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <bfc/platform/guid.h>
  7. // {CAC1D7F6-AA27-47eb-BAF7-512BAAE04F07}
  8. static const GUID IFC_Device =
  9. { 0xcac1d7f6, 0xaa27, 0x47eb, { 0xba, 0xf7, 0x51, 0x2b, 0xaa, 0xe0, 0x4f, 0x7 } };
  10. #include "ifc_deviceobject.h"
  11. class ifc_deviceevent;
  12. class ifc_devicesupportedcommandenum;
  13. class ifc_deviceactivity;
  14. typedef enum DeviceCommandFlags DeviceCommandFlags;
  15. typedef enum DeviceCommandContext DeviceCommandContext;
  16. class __declspec(novtable) ifc_device : public ifc_deviceobject
  17. {
  18. protected:
  19. ifc_device() {}
  20. ~ifc_device() {}
  21. public:
  22. const char *GetType();
  23. const char *GetDisplayType();
  24. const char *GetConnection();
  25. BOOL GetHidden();
  26. HRESULT GetTotalSpace(uint64_t *size);
  27. HRESULT GetUsedSpace(uint64_t *size);
  28. BOOL GetAttached();
  29. HRESULT Attach(HWND hostWindow);
  30. HRESULT Detach(HWND hostWindow);
  31. HRESULT EnumerateCommands(ifc_devicesupportedcommandenum **enumerator, DeviceCommandContext context);
  32. HRESULT SendCommand(const char *command, HWND hostWindow, ULONG_PTR param);
  33. HRESULT GetCommandFlags(const char *command, DeviceCommandFlags *flags);
  34. HRESULT GetActivity(ifc_deviceactivity **activity);
  35. HRESULT Advise(ifc_deviceevent *handler);
  36. HRESULT Unadvise(ifc_deviceevent *handler);
  37. HWND CreateView(HWND parentWindow);
  38. void SetNavigationItem(void *navigationItem);
  39. HRESULT GetDropSupported(unsigned int dataType);
  40. HRESULT Drop(void *data, unsigned int dataType);
  41. HRESULT SetDisplayName(const wchar_t *displayName);
  42. HRESULT GetModel(wchar_t *buffer, size_t bufferSize); // - end-user-visible name for the end produt.
  43. HRESULT GetStatus(wchar_t *buffer, size_t bufferSize); // - free-form status message (example: "Last synchronized 19:20 01/10/10").
  44. public:
  45. DISPATCH_CODES
  46. {
  47. API_GETTYPE = 10,
  48. API_GETCONNECTION = 20,
  49. API_GETHIDDEN = 30,
  50. API_GETTOTALSPACE = 40,
  51. API_GETUSEDSPACE = 50,
  52. API_GETATTACHED = 60,
  53. API_ATTACH = 70,
  54. API_DETACH = 80,
  55. API_ENUMERATECOMMANDS = 90,
  56. API_SENDCOMMAND = 100,
  57. API_GETCOMMANDFLAGS = 110,
  58. API_GETACTIVITY = 120,
  59. API_ADVISE = 130,
  60. API_UNADVISE = 140,
  61. API_CREATEVIEW = 150,
  62. API_SETNAVIGATIONITEM = 160,
  63. API_GETDROPSUPPORTED = 170,
  64. API_DROP = 180,
  65. API_SETDISPLAYNAME = 190,
  66. API_GETMODEL = 200,
  67. API_GETSTATUS = 210,
  68. API_GETDISPLAYTYPE = 220,
  69. };
  70. };
  71. inline const char *ifc_device::GetType()
  72. {
  73. return _call(API_GETTYPE, (const char*)NULL);
  74. }
  75. inline const char *ifc_device::GetDisplayType()
  76. {
  77. return _call(API_GETDISPLAYTYPE, (const char*)NULL);
  78. }
  79. inline const char *ifc_device::GetConnection()
  80. {
  81. return _call(API_GETCONNECTION, (const char*)NULL);
  82. }
  83. inline BOOL ifc_device::GetHidden()
  84. {
  85. return _call(API_GETHIDDEN, (BOOL)FALSE);
  86. }
  87. inline HRESULT ifc_device::GetTotalSpace(uint64_t *size)
  88. {
  89. return _call(API_GETTOTALSPACE, (HRESULT)E_NOTIMPL, size);
  90. }
  91. inline HRESULT ifc_device::GetUsedSpace(uint64_t *size)
  92. {
  93. return _call(API_GETUSEDSPACE, (HRESULT)E_NOTIMPL, size);
  94. }
  95. inline BOOL ifc_device::GetAttached()
  96. {
  97. return _call(API_GETATTACHED, (BOOL)FALSE);
  98. }
  99. inline HRESULT ifc_device::Attach(HWND hostWindow)
  100. {
  101. return _call(API_ATTACH, (HRESULT)E_NOTIMPL, hostWindow);
  102. }
  103. inline HRESULT ifc_device::Detach(HWND hostWindow)
  104. {
  105. return _call(API_DETACH, (HRESULT)E_NOTIMPL, hostWindow);
  106. }
  107. inline HRESULT ifc_device::EnumerateCommands(ifc_devicesupportedcommandenum **enumerator, DeviceCommandContext context)
  108. {
  109. return _call(API_ENUMERATECOMMANDS, (HRESULT)E_NOTIMPL, enumerator, context);
  110. }
  111. inline HRESULT ifc_device::SendCommand(const char *command, HWND hostWindow, ULONG_PTR param)
  112. {
  113. return _call(API_SENDCOMMAND, (HRESULT)E_NOTIMPL, command, hostWindow, param);
  114. }
  115. inline HRESULT ifc_device::GetCommandFlags(const char *command, DeviceCommandFlags *flags)
  116. {
  117. return _call(API_GETCOMMANDFLAGS, (HRESULT)E_NOTIMPL, command, flags);
  118. }
  119. inline HRESULT ifc_device::GetActivity(ifc_deviceactivity **activity)
  120. {
  121. return _call(API_GETACTIVITY, (HRESULT)E_NOTIMPL, activity);
  122. }
  123. inline HRESULT ifc_device::Advise(ifc_deviceevent *handler)
  124. {
  125. return _call(API_ADVISE, (HRESULT)E_NOTIMPL, handler);
  126. }
  127. inline HRESULT ifc_device::Unadvise(ifc_deviceevent *handler)
  128. {
  129. return _call(API_UNADVISE, (HRESULT)E_NOTIMPL, handler);
  130. }
  131. inline HWND ifc_device::CreateView(HWND parentWindow)
  132. {
  133. return _call(API_CREATEVIEW, (HWND)NULL, parentWindow);
  134. }
  135. inline void ifc_device::SetNavigationItem(void *navigationItem)
  136. {
  137. _voidcall(API_SETNAVIGATIONITEM, navigationItem);
  138. }
  139. inline HRESULT ifc_device::GetDropSupported(unsigned int dataType)
  140. {
  141. return _call(API_GETDROPSUPPORTED, (HRESULT)E_NOTIMPL, dataType);
  142. }
  143. inline HRESULT ifc_device::Drop(void *data, unsigned int dataType)
  144. {
  145. return _call(API_DROP, (HRESULT)E_NOTIMPL, data, dataType);
  146. }
  147. inline HRESULT ifc_device::SetDisplayName(const wchar_t *displayName)
  148. {
  149. return _call(API_SETDISPLAYNAME, (HRESULT)E_NOTIMPL, displayName);
  150. }
  151. inline HRESULT ifc_device::GetModel(wchar_t *buffer, size_t bufferSize)
  152. {
  153. return _call(API_GETMODEL, (HRESULT)E_NOTIMPL, buffer, bufferSize);
  154. }
  155. inline HRESULT ifc_device::GetStatus(wchar_t *buffer, size_t bufferSize)
  156. {
  157. return _call(API_GETSTATUS, (HRESULT)E_NOTIMPL, buffer, bufferSize);
  158. }
  159. #endif // _NULLSOFT_WINAMP_DEVICES_DEVICE_INTERFACE_HEADER