controller_hidd
CLID_Hidd_Controller
| --background_controllerclass-- |
--background_controllerclass--
Notes
Objects of this class play one of two roles. Device role: a hardware driver class derives from CLID_Hidd_Controller and is instantiated through moHW_AddDriver on the CLID_HW_Controller subsystem object. One object represents one physical controller. The driver supplies its identity and its control table at creation time (aHidd_Controller_* [I..] attributes) and afterwards pushes raw input with the Push methods of IID_Hidd_Controller. The base class normalises values, keeps a cached reading, evaluates the standard gamepad layout and delivers events. Output requests (rumble, LEDs, effects) are IID_Hidd_Controller methods the driver overrides; the driver calls the superclass method after acting on the hardware so that the last requested values are recorded. Consumer role: a client creates a plain CLID_Hidd_Controller object to receive events, either from one device (aHidd_Controller_Device or aHidd_Controller_DeviceFilter) or from the whole subsystem, which also delivers DeviceAdded/DeviceRemoved events including an initial salvo of DeviceAdded for devices already present. Delivery is by callback (aHidd_Input_IrqHandler, producer context), by task signal (aHidd_Controller_NotifyTask/NotifySignal, drain with moHidd_Controller_GetEvent) or by message port (aHidd_Controller_NotifyPort, reply the messages). Current state of any device is read with moHidd_Controller_GetReading from any context.
CLID_HW_Controller
| --background_subsystem-- | --hardware_drivers-- |
--background_subsystem--
Notes
The subsystem object is a singleton: OOP_NewObject(NULL, CLID_HW_Controller, NULL) always returns the same object and it must not be disposed. Hardware drivers register one object per controller with moHW_AddDriver (the driver class must derive from CLID_Hidd_Controller) and remove it with moHW_RemoveDriver when the device goes away. The subsystem assigns a device id that is never reused, works out the standard layout, assigns a lowlevel.library joyport according to the slot policy, and publishes DeviceAdded/DeviceRemoved events. Consumers enumerate devices with moHW_EnumDrivers (the hook receives the device objects), moHW_Controller_GetDeviceIDs or by creating a subsystem wide CLID_Hidd_Controller consumer, and look devices up with moHW_Controller_FindDevice.
--hardware_drivers--
Notes
A hardware driver is a subclass of CLID_Hidd_Controller. One object represents one controller. In its Root::New the driver passes its identity (aHidd_Name, aHidd_HardwareName, aHidd_Controller_VendorID/ProductID/Version, aHidd_Controller_Bus, aHidd_Controller_Serial, ...), its control table (aHidd_Controller_ControlTable), output table (aHidd_Controller_OutputTable) and optionally a binding table for the standard layout (aHidd_Controller_BindingTable) to the superclass. Input is delivered by calling the Push methods of IID_Hidd_Controller on the object itself, from any context. Output is implemented by overriding the IID_Hidd_Controller output methods and calling the superclass afterwards. Knowledge about particular devices (layouts, quirks) belongs to the driver class: a driver that knows its device passes aHidd_Controller_BindingTable; without it the subsystem synthesises a layout from the HID usages in the control table.


