public class GpioControl
extends net.solarnetwork.node.io.serial.support.SerialDeviceSupport
implements net.solarnetwork.settings.SettingSpecifierProvider, net.solarnetwork.node.service.NodeControlProvider, net.solarnetwork.node.reactor.InstructionHandler, net.solarnetwork.settings.SettingsChangeObserver
NodeControlProvider for the Numato USB GPIO module.| Modifier and Type | Class and Description |
|---|---|
static interface |
GpioControl.GpioServiceAction<T>
API for interacting with the GpioService.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_GPIO_LOCK_TIMEOUT_SECS
The
gpioLockTimeoutSecs property default value. |
static java.lang.String |
DEFAULT_SERIAL_NETWORK_UID
The
serialNetworkUid property default value. |
EVENT_TOPIC_CONTROL_INFO_CAPTURED, EVENT_TOPIC_CONTROL_INFO_CHANGEDGROUP_UID_PROPERTY, UID_PROPERTYPARAM_MESSAGE, PARAM_SERVICE, PARAM_SERVICE_ARGUMENT, PARAM_SERVICE_RESULT, PARAM_STATUS_CODE, TOPIC_DEMAND_BALANCE, TOPIC_SET_CONTROL_PARAMETER, TOPIC_SET_OPERATING_STATE, TOPIC_SHED_LOAD, TOPIC_SIGNAL, TOPIC_SYSTEM_CONFIGURE| Constructor and Description |
|---|
GpioControl(net.solarnetwork.service.OptionalService.OptionalFilterableService<net.solarnetwork.node.io.serial.SerialNetwork> serialNetwork)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
configurationChanged(java.util.Map<java.lang.String,java.lang.Object> properties) |
java.util.List<java.lang.String> |
getAvailableControlIds() |
net.solarnetwork.domain.NodeControlInfo |
getCurrentControlInfo(java.lang.String controlId) |
int |
getGpioLockTimeoutSecs()
Get the maximum number of seconds to wait to acquire the GPIO lock.
|
GpioPropertyConfig[] |
getPropConfigs()
Get the property configurations.
|
int |
getPropConfigsCount()
Get the number of configured
propConfigs elements. |
java.util.function.Function<net.solarnetwork.node.io.serial.SerialConnection,GpioService> |
getServiceProvider()
Get the
GpioService provider. |
java.util.List<net.solarnetwork.settings.SettingSpecifier> |
getSettingSpecifiers() |
java.lang.String |
getSettingUid() |
boolean |
handlesTopic(java.lang.String topic) |
protected <T> T |
performAction(net.solarnetwork.node.io.serial.SerialConnectionAction<T> action) |
net.solarnetwork.node.reactor.InstructionStatus |
processInstruction(net.solarnetwork.node.reactor.Instruction instruction) |
protected java.util.Map<java.lang.String,java.lang.Object> |
readDeviceInfo(net.solarnetwork.node.io.serial.SerialConnection conn) |
void |
setGpioLockTimeoutSecs(int gpioLockTimeoutSecs)
Set the maximum number of seconds to wait to acquire the GPIO lock.
|
void |
setPropConfigs(GpioPropertyConfig[] propConfigs)
Get the property configurations to use.
|
void |
setPropConfigsCount(int count)
Adjust the number of configured
propConfigs elements. |
void |
setSerialNetwork(net.solarnetwork.service.OptionalService.OptionalFilterableService<net.solarnetwork.node.io.serial.SerialNetwork> serialDevice) |
void |
setServiceProvider(java.util.function.Function<net.solarnetwork.node.io.serial.SerialConnection,GpioService> serviceProvider)
Set a
GpioService provider. |
void |
shutdown()
Call when no longer needed.
|
void |
startup()
Call once after properties configured.
|
getDeviceInfo, getDeviceInfoMap, getDeviceInfoMessage, getEventAdmin, getSerialNetwork, getSerialNetworkUid, postEvent, serialNetworkSettings, setDeviceInfoMap, setEventAdmin, setSerialNetworkUidbaseIdentifiableSettings, baseIdentifiableSettings, getExpressionServices, getPlaceholderService, populateExpressionDatumProperties, resolvePlaceholders, resolvePlaceholders, setExpressionServices, setPlaceholderServicebasicIdentifiableMetadataSettings, basicIdentifiableSettings, basicIdentifiableSettings, basicIdentifiableSettings, doubleMetadataValue, getDisplayName, getGroupUid, getGroupUID, getMessageSource, getMetadata, getMetadataCount, getUid, getUID, integerMetadataValue, metadataValue, numberMetadataValue, saveMetadataValue, saveMetadataValue, setDisplayName, setGroupUid, setGroupUID, setMessageSource, setMetadata, setMetadataCount, setUid, setUID, smartMetadataValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final java.lang.String DEFAULT_SERIAL_NETWORK_UID
serialNetworkUid property default value.public static final int DEFAULT_GPIO_LOCK_TIMEOUT_SECS
gpioLockTimeoutSecs property default value.public GpioControl(net.solarnetwork.service.OptionalService.OptionalFilterableService<net.solarnetwork.node.io.serial.SerialNetwork> serialNetwork)
serialNetwork - the network to usepublic void startup()
public void shutdown()
public void configurationChanged(java.util.Map<java.lang.String,java.lang.Object> properties)
configurationChanged in interface net.solarnetwork.settings.SettingsChangeObserverpublic void setSerialNetwork(net.solarnetwork.service.OptionalService.OptionalFilterableService<net.solarnetwork.node.io.serial.SerialNetwork> serialDevice)
setSerialNetwork in class net.solarnetwork.node.io.serial.support.SerialDeviceSupportpublic boolean handlesTopic(java.lang.String topic)
handlesTopic in interface net.solarnetwork.node.reactor.InstructionHandlerpublic net.solarnetwork.node.reactor.InstructionStatus processInstruction(net.solarnetwork.node.reactor.Instruction instruction)
processInstruction in interface net.solarnetwork.node.reactor.InstructionHandlerprotected <T> T performAction(net.solarnetwork.node.io.serial.SerialConnectionAction<T> action)
throws java.io.IOException
performAction in class net.solarnetwork.node.io.serial.support.SerialDeviceSupportjava.io.IOExceptionprotected java.util.Map<java.lang.String,java.lang.Object> readDeviceInfo(net.solarnetwork.node.io.serial.SerialConnection conn)
throws java.io.IOException
readDeviceInfo in class net.solarnetwork.node.io.serial.support.SerialDeviceSupportjava.io.IOExceptionpublic java.util.List<java.lang.String> getAvailableControlIds()
getAvailableControlIds in interface net.solarnetwork.node.service.NodeControlProviderpublic net.solarnetwork.domain.NodeControlInfo getCurrentControlInfo(java.lang.String controlId)
getCurrentControlInfo in interface net.solarnetwork.node.service.NodeControlProviderpublic java.lang.String getSettingUid()
getSettingUid in interface net.solarnetwork.settings.SettingSpecifierProviderpublic java.util.List<net.solarnetwork.settings.SettingSpecifier> getSettingSpecifiers()
getSettingSpecifiers in interface net.solarnetwork.settings.SettingSpecifierProviderpublic GpioPropertyConfig[] getPropConfigs()
public void setPropConfigs(GpioPropertyConfig[] propConfigs)
propConfigs - the configs to usepublic int getPropConfigsCount()
propConfigs elements.propConfigs elementspublic void setPropConfigsCount(int count)
propConfigs elements.
Any newly added element values will be set to new
GpioPropertyConfig instances.
count - The desired number of propConfigs elements.public java.util.function.Function<net.solarnetwork.node.io.serial.SerialConnection,GpioService> getServiceProvider()
GpioService provider.UsbGpioService::newpublic void setServiceProvider(java.util.function.Function<net.solarnetwork.node.io.serial.SerialConnection,GpioService> serviceProvider)
GpioService provider.serviceProvider - the provider to set; if null then
UsbGpioService::new will be usedpublic int getGpioLockTimeoutSecs()
DEFAULT_GPIO_LOCK_TIMEOUT_SECSpublic void setGpioLockTimeoutSecs(int gpioLockTimeoutSecs)
gpioLockTimeoutSecs - the maximum number of seconds