mattjlewis / diozero

Java Device I/O library that is portable across Single Board Computers and microcontrollers. Tested with Raspberry Pi, Odroid C2, BeagleBone Black, Next Thing CHIP, Asus Tinker Board and Arduinos / Pico. Supports GPIO, I2C, SPI as well as Serial communication. Also known to work with Udoo Quad.
https://www.diozero.com
MIT License
261 stars 59 forks source link

Enhancement: AbstractDeviceFactory can "register" devices #131

Closed EAGrahamJr closed 1 year ago

EAGrahamJr commented 1 year ago

There are several methods used with the DeviceStates internal class to determine whether or not devices are "opened" or not (isDeviceOpened, deviceOpened, deviceClosed).

deviceClosed is actually invoked by the AbstractDevice. However, there is no "automatic" (or semi-automatic) means to utilized the other two associated functions.

This issue is to track the addition of a method to the AbstractDeviceFactory for implementations to easily track device open/close.

EAGrahamJr commented 1 year ago

I see this is actually managed in sub-classes of this factory - closing.

mattjlewis commented 1 year ago

np - this internal aspect has evolved a bit over the years - doing my best to provide a completely seamless user experience and handle all of the device cleanup stuff.