aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Portable/pmp_wifi/WifiDevice.h
blob: a7065c6bcb2969ae6a5465695ed490b591f1e541 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#pragma once
#include <bfc/platform/types.h>
#include "../devices/ifc_device.h"
#include "device.h"
#include "../nu/refcount.h"
#include "ConnectActivity.h"
#include "main.h"
/* this one inherits from ifc_device (not Device from ml_pmp) and is used to manage
  attaching/detaching, etc from the device view */
class TemplateDevice;
class WifiDevice : public Countable<ifc_device>
{
public:
	WifiDevice(const char *root_url, const DeviceInfo *device_info);
	~WifiDevice();
		/* --- ifc_device interface --- */
	int QueryInterface(GUID interface_guid, void **object);
	HRESULT GetDisplayName(wchar_t *buffer, size_t bufferSize);
	const char *GetName();
	HRESULT GetIcon(wchar_t *buffer, size_t bufferSize, int width, int height);
	const char *GetType();
	const char *GetConnection();

	BOOL GetHidden();
	
	HRESULT GetTotalSpace(uint64_t *size);
	HRESULT GetUsedSpace(uint64_t *size);

	BOOL GetAttached();
	HRESULT Attach(HWND hostWindow);
	HRESULT Detach(HWND hostWindow);
	
	HRESULT EnumerateCommands(ifc_devicesupportedcommandenum **enumerator, DeviceCommandContext context);
	HRESULT SendCommand(const char *command, HWND hostWindow, ULONG_PTR param);
	HRESULT GetActiveCommand(char *buffer, size_t bufferSize);
	HRESULT CancelCommand(const char *command, HWND hostWindow);
	HRESULT GetCommandFlags(const char *command, DeviceCommandFlags *flags);

	HRESULT Advise(ifc_deviceevent *handler);
	HRESULT Unadvise(ifc_deviceevent *handler);

	HWND CreateView(HWND parentWindow);
	void SetNavigationItem(void *navigationItem); 

	void OnPaired();
	void OnConnected(TemplateDevice *device);
	void OnConnectionFailed();
	void OnDisconnect();
	HRESULT GetModel(wchar_t *buffer, size_t bufferSize);

	HRESULT GetActivity(ifc_deviceactivity **activity);

	REFERENCE_COUNT_IMPLEMENTATION;
private:	
	DeviceInfo device_info;
	RECVS_DISPATCH;
	char id_string[32];
	char *url;
	TemplateDevice *pmp_device;
	ConnectActivity connect_activity;
	bool connect_active;
	volatile int dead;
	CRITICAL_SECTION register_lock;
};