neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
i_hid_devices.hpp
Go to the documentation of this file.
1// i_hid_devices.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
25
26namespace neogfx
27{
30
31 class i_hid_devices : public i_service
32 {
33 public:
34 declare_event(device_connected, i_hid_device&)
35 declare_event(device_disconnected, i_hid_device&)
36 public:
38 public:
39 virtual ~i_hid_devices() = default;
40 public:
41 virtual void enumerate_devices() = 0;
42 virtual const device_list& devices() const = 0;
43 virtual void add_device(i_hid_device& aDevice) = 0;
44 virtual void remove_device(i_hid_device& aDevice) = 0;
45 public:
46 virtual hid_device_class device_class(const hid_device_class_uuid& aClassUuid) const = 0;
47 virtual hid_device_subclass device_subclass(const hid_device_subclass_uuid& aClassUuid) const = 0;
48 virtual const i_string& product_name(hid_device_class aClass, const hid_device_uuid& aProductId) const = 0;
49 public:
50 template <typename Device>
52 {
53 auto newDevice = make_ref<Device>();
54 add_device(*newDevice);
55 return newDevice;
56 }
57 public:
58 static uuid const& iid() { static uuid const sIid{ 0xc97d8f86, 0xa1db, 0x4c8b, 0x8531, { 0x90, 0xba, 0x5b, 0x34, 0x27, 0x47 } }; return sIid; }
59 };
60}
virtual const i_string & product_name(hid_device_class aClass, const hid_device_uuid &aProductId) const =0
virtual void remove_device(i_hid_device &aDevice)=0
virtual const device_list & devices() const =0
virtual hid_device_subclass device_subclass(const hid_device_subclass_uuid &aClassUuid) const =0
neolib::i_vector< i_ref_ptr< i_hid_device > > device_list
static uuid const & iid()
declare_event(device_connected, i_hid_device &) declare_event(device_disconnected
virtual ~i_hid_devices()=default
virtual void enumerate_devices()=0
virtual void add_device(i_hid_device &aDevice)=0
ref_ptr< Device > add_device()
virtual hid_device_class device_class(const hid_device_class_uuid &aClassUuid) const =0
hid_device_uuid hid_device_subclass_uuid
hid_device_uuid hid_device_class_uuid
#define declare_event(declName,...)
Definition i_event.hpp:305