1
0

WifiDevice.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #include <bfc/platform/types.h>
  3. #include "../devices/ifc_device.h"
  4. #include "device.h"
  5. #include "../nu/refcount.h"
  6. #include "ConnectActivity.h"
  7. #include "main.h"
  8. /* this one inherits from ifc_device (not Device from ml_pmp) and is used to manage
  9. attaching/detaching, etc from the device view */
  10. class TemplateDevice;
  11. class WifiDevice : public Countable<ifc_device>
  12. {
  13. public:
  14. WifiDevice(const char *root_url, const DeviceInfo *device_info);
  15. ~WifiDevice();
  16. /* --- ifc_device interface --- */
  17. int QueryInterface(GUID interface_guid, void **object);
  18. HRESULT GetDisplayName(wchar_t *buffer, size_t bufferSize);
  19. const char *GetName();
  20. HRESULT GetIcon(wchar_t *buffer, size_t bufferSize, int width, int height);
  21. const char *GetType();
  22. const char *GetConnection();
  23. BOOL GetHidden();
  24. HRESULT GetTotalSpace(uint64_t *size);
  25. HRESULT GetUsedSpace(uint64_t *size);
  26. BOOL GetAttached();
  27. HRESULT Attach(HWND hostWindow);
  28. HRESULT Detach(HWND hostWindow);
  29. HRESULT EnumerateCommands(ifc_devicesupportedcommandenum **enumerator, DeviceCommandContext context);
  30. HRESULT SendCommand(const char *command, HWND hostWindow, ULONG_PTR param);
  31. HRESULT GetActiveCommand(char *buffer, size_t bufferSize);
  32. HRESULT CancelCommand(const char *command, HWND hostWindow);
  33. HRESULT GetCommandFlags(const char *command, DeviceCommandFlags *flags);
  34. HRESULT Advise(ifc_deviceevent *handler);
  35. HRESULT Unadvise(ifc_deviceevent *handler);
  36. HWND CreateView(HWND parentWindow);
  37. void SetNavigationItem(void *navigationItem);
  38. void OnPaired();
  39. void OnConnected(TemplateDevice *device);
  40. void OnConnectionFailed();
  41. void OnDisconnect();
  42. HRESULT GetModel(wchar_t *buffer, size_t bufferSize);
  43. HRESULT GetActivity(ifc_deviceactivity **activity);
  44. REFERENCE_COUNT_IMPLEMENTATION;
  45. private:
  46. DeviceInfo device_info;
  47. RECVS_DISPATCH;
  48. char id_string[32];
  49. char *url;
  50. TemplateDevice *pmp_device;
  51. ConnectActivity connect_activity;
  52. bool connect_active;
  53. volatile int dead;
  54. CRITICAL_SECTION register_lock;
  55. };