23 #include "RuleSet.hpp" 24 #include "Typedefs.hpp" 35 class DeviceManagerHooks;
36 class DeviceManagerPrivate;
80 static uint32_t eventTypeToInteger(EventType event);
90 static EventType eventTypeFromInteger(uint32_t event_integer);
100 static std::string eventTypeToString(EventType event);
111 static int32_t authorizedDefaultTypeToInteger(AuthorizedDefaultType authorized_default);
123 static AuthorizedDefaultType authorizedDefaultTypeFromInteger(int32_t authorized_default_integer);
135 static AuthorizedDefaultType authorizedDefaultTypeFromString(
const std::string& authorized_default_string);
147 static const std::string authorizedDefaultTypeToString(AuthorizedDefaultType authorized_default);
184 virtual void setEnumerationOnlyMode(
bool state) = 0;
189 virtual void start() = 0;
194 virtual void stop() = 0;
199 virtual void scan() = 0;
206 virtual void scan(
const std::string& devpath) = 0;
215 void setAuthorizedDefault(AuthorizedDefaultType authorized);
225 AuthorizedDefaultType getAuthorizedDefault()
const;
244 void setRestoreControllerDeviceState(
bool enabled);
253 bool getRestoreControllerDeviceState()
const;
262 virtual std::shared_ptr<Device> applyDevicePolicy(uint32_t
id,
Rule::Target target) = 0;
271 virtual void insertDevice(std::shared_ptr<Device> device);
280 std::shared_ptr<Device> removeDevice(uint32_t
id);
287 std::vector<std::shared_ptr<Device>> getDeviceList();
298 std::vector<std::shared_ptr<Device>> getDeviceList(
const Rule& query);
307 std::shared_ptr<Device> getDevice(uint32_t
id);
314 std::mutex& refDeviceMapMutex();
326 void DeviceEvent(EventType event, std::shared_ptr<Device> device);
338 void DeviceException(
const std::string& message);
358 static std::shared_ptr<DeviceManager> create(
DeviceManagerHooks& hooks,
const std::string& backend);
361 std::unique_ptr<DeviceManagerPrivate> d_pointer;
Target
Enumeration of possible rule targets.
Definition: Rule.hpp:86
AuthorizedDefaultType
Defines which devices are authorized by default.
Definition: DeviceManager.hpp:61
Manages and keeps track of active USB devices.
Definition: DeviceManager.hpp:44
Allows reacting to device events.
Definition: DeviceManagerHooks.hpp:35
Determines whether USB device mathing specified criteria should be authorized, deauthorized or remove...
Definition: Rule.hpp:77
EventType
Type of event that took place on the device.
Definition: DeviceManager.hpp:51