PioDriverManager
public
class
PioDriverManager
extends Object
java.lang.Object | |
↳ | com.google.android.things.pio.PioDriverManager |
Manager for PIO userspace drivers. Registered drivers are individually synchronized to guarantee that no calls will be made before open() or after close(), and no calls will be made concurrently on the same driver. Driver registration and unregistration is also thread-safe and may be done while a driver is in use. If a driver is unregistered while in use, subsequent calls will raise an exception.
Summary
Public constructors | |
---|---|
PioDriverManager()
|
Public methods | |
---|---|
void
|
registerGpioDriver(String name, GpioDriver driver)
Registers a new GPIO driver with the PIO manager. |
void
|
registerPwmDriver(String name, PwmDriver driver)
Registers a new PWM driver with the PIO manager. |
void
|
unregisterGpioDriver(String name)
Unregisters an existing GPIO driver from the PIO manager. |
void
|
unregisterPwmDriver(String name)
Unregisters an existing PWM driver from the PIO manager. |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Public constructors
PioDriverManager
</div>
PioDriverManager ()
Throws | |
---|---|
IllegalStateException |
Failed to connect to the PIO service. |
</div>
Public methods
registerGpioDriver
</div>
void registerGpioDriver (String name, GpioDriver driver)
Registers a new GPIO driver with the PIO manager.
Parameters | |
---|---|
name |
String :
GPIO name. |
driver |
GpioDriver :
GPIO driver. |
Throws | |
---|---|
IOException |
failed to register the driver. |
</div>
registerPwmDriver
</div>
void registerPwmDriver (String name, PwmDriver driver)
Registers a new PWM driver with the PIO manager.
Parameters | |
---|---|
name |
String :
PWM name. |
driver |
PwmDriver :
PWM driver. |
Throws | |
---|---|
IOException |
failed to register the driver. |
</div>
unregisterGpioDriver
</div>
void unregisterGpioDriver (String name)
Unregisters an existing GPIO driver from the PIO manager.
If the named driver is open it will be closed and any subsequent usage by the owner will throw IOException.
If the named driver doesn't exist this method has no effect.</p>
Parameters | |
---|---|
name |
String :
GPIO name. |
Throws | |
---|---|
IOException |
error while closing the driver; driver will still be unregistered. |
</div>
unregisterPwmDriver
</div>
void unregisterPwmDriver (String name)
Unregisters an existing PWM driver from the PIO manager.
If the named driver is open it will be closed and any subsequent usage by the owner will throw IOException.
If the named driver doesn't exist this method has no effect.</p>
Parameters | |
---|---|
name |
String :
PWM name. |
Throws | |
---|---|
IOException |
error while closing the driver; driver will still be unregistered. |
</div>