This repository was archived by the owner on May 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
DeviceManager Programmer Notes
Guido Sanchez edited this page Apr 29, 2017
·
5 revisions
DeviceManager
Members
DeviceManagerConfigPtr m_config;
// OS specific implementation of hotplug notification
eDevicePlatformApiType m_platform_api_type;
IPlatformDeviceAPI *m_platform_api;
// List of registered hot-plug listeners
std::vector<DeviceHotplugListener> m_listeners;
class ControllerManager *m_controller_manager;
class TrackerManager *m_tracker_manager;
class HMDManager *m_hmd_manager;
Functions
bool startup(); /**< Initialize the interfaces for each specific manager. */
void update(); /**< Poll all connected devices for each specific manager. */
bool get_device_property(
const DeviceClass deviceClass,
const int vendor_id,
const int product_id,
const char *property_name,
char *buffer,
const int buffer_size);
void handle_device_connected(enum DeviceClass device_class, const std::string &device_path) override;
void handle_device_disconnected(enum DeviceClass device_class, const std::string &device_path) override;
DeviceTypeManager
Members
std::chrono::time_point<std::chrono::high_resolution_clock> m_last_reconnect_time;
std::chrono::time_point<std::chrono::high_resolution_clock> m_last_poll_time;
ServerDeviceViewPtr *m_deviceViews;
bool m_bIsDeviceListDirty;
Functions
virtual bool startup();
virtual void shutdown();
void poll();
virtual void publish();
/**
Returns an upcast device view ptr. Useful for generic functions that are
simple wrappers around the device functions:
open(), getIsOpen(), update(), close(), getIsReadyToPoll()
For anything that requires knowledge of the device, use the class-specific
Server<Type>ViewPtr get<Type>ViewPtr(int device_id) functions instead.
*/
ServerDeviceViewPtr getDeviceViewPtr(int device_id);
// IDeviceHotplugListener
void handle_device_connected(enum DeviceClass device_class, const std::string &device_path) override;
void handle_device_disconnected(enum DeviceClass device_class, const std::string &device_path) override;
The DeviceEnumerator
is a simple iterator that walks over all connected devices of a specified device class that match a USB VendorID and ProductID. DeviceManagers that derive from DeviceTypeMangager
allocate enumerators derived from DeviceEnumerator
.
Iterates over connected HID controllers of the following types using HIDAPI:
- VID:0x054c/PID:0x03d4 (Vendor:Sony, Product:PSMove)
- VID:0x054c/PID:0x042f (Vendor:Sony, Product:PSNavi)
Iterates over connected cameras of the following types using LIBUSB:
- VID:0x1415/PID:0x2000 (Vendor:Sony, Product:PS3EYE)
Iterates over connected HMDs of the following types using HIDAPI:
- VID:0x2833/PID:0x0021 (Vendor:Oculus, Product:DK2)