whirvis / ketill

🎮 An API for dynamic device I/O.
https://ketill.io
MIT License
4 stars 1 forks source link

Add battery level support #38

Open whirvis opened 2 years ago

whirvis commented 2 years ago

An I/O feature representing the battery level of a device should be added when possible to the controller module. The class of the I/O feature may possibly be named Battery or InternalBattery, and its state class BatteryLevel. The state class shall have a method named getLevel(), which returns a floating point value from 0.0 for an empty battery and 1.0 for a fully charged battery. It shall also have a method called getPercentage(), which calls getLevel() and converts its value to an integer with a range from 0 to 100.

Device classes which may have a battery feature could be, but are not limited to: XboxController, Ps3Controller, Ps4Controller, Ps5Controller, Wiimote, NxLeftJoyCon, NxRightJoyCon, and NxProController.

UPDATE: The xinput module now supports the INTERNAL_BATTERY feature present in XboxController.

whirvis commented 2 years ago

While not fully implemented, the feature InternalBattery with state BatteryLevelZ / BatteryLevel has been added in commit 16de8ff8d2f13023b19b8bcb448bfdab528bb024. A later version of Ketill will fully support these features. At which point, this issue will be closed accordingly.