public abstract class ChangeDataModel extends AbstractBaseDataModel
executor
Constructor and Description |
---|
ChangeDataModel(String threadName) |
Modifier and Type | Method and Description |
---|---|
BackgroundIterator |
createBackgroundIterator()
Create a new background iterator
If the implementation does not support background transmissions, null may be returned. |
protected abstract BackgroundModel |
createBackgroundModel()
Create a BackgroundModel for this data model instance
|
protected abstract ChangeModel |
createChangeModel()
Create a ChangeModel for this data model instance
|
protected abstract WriteModel |
createWriteModel()
Create a WriteModel for this data model instance
|
void |
forAllAsdu(java.util.function.Consumer<ASDUAddress> function,
Runnable ifNoneFound)
A method that will call the provided function for each known ASDU
address
|
protected ChangeModel |
makeBufferingChangeModel(long flushDelay) |
protected BackgroundModel |
makeDefaultBackgroundModel() |
protected ChangeModel |
makeInstantChangeModel() |
protected void |
notifyDataChange(ASDUAddress asduAddress,
InformationObjectAddress informationObjectAddress,
Value<?> value,
boolean notify) |
protected void |
performForAllAsdu(java.util.function.Consumer<ASDUAddress> function,
Runnable ifNoneFound) |
protected Value<?> |
performRead(ASDUAddress asduAddress,
InformationObjectAddress address) |
protected void |
performReadAll(ASDUAddress asduAddress,
DataListener listener,
Map<Integer,Value<?>> map) |
com.google.common.util.concurrent.ListenableFuture<Value<?>> |
read(ASDUAddress asduAddress,
InformationObjectAddress address)
Read a specific value
The future will be called with the result of the read operation. |
com.google.common.util.concurrent.ListenableFuture<Void> |
readAll(ASDUAddress asduAddress,
Runnable prepare,
DataListener listener)
Read all values from the internal structures
The data will not be returned by the future, but pushed to the DataListener . |
void |
start() |
Stopping |
stop() |
void |
writeCommand(ASDUHeader header,
InformationObjectAddress informationObjectAddress,
boolean state,
byte type,
MirrorCommand mirrorCommand,
boolean execute) |
void |
writeFloatValue(ASDUHeader header,
InformationObjectAddress informationObjectAddress,
float value,
byte type,
MirrorCommand mirrorCommand,
boolean execute) |
void |
writeScaledValue(ASDUHeader header,
InformationObjectAddress informationObjectAddress,
short value,
byte type,
MirrorCommand mirrorCommand,
boolean execute) |
disposeSubscription, getNumberOfSubscriptions, notifyChangeBoolean, notifyChangeBoolean, notifyChangeFloat, notifyChangeFloat, subscribe
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forAllAsdu
public ChangeDataModel(String threadName)
protected abstract ChangeModel createChangeModel()
This method is called exactly once by the start()
method
protected abstract WriteModel createWriteModel()
This method is called exactly once by the start()
method
protected abstract BackgroundModel createBackgroundModel()
This method is called exactly once by the start()
method
public void start()
start
in interface DataModel
start
in class AbstractBaseDataModel
public Stopping stop()
stop
in interface DataModel
stop
in class AbstractBaseDataModel
protected BackgroundModel makeDefaultBackgroundModel()
protected ChangeModel makeInstantChangeModel()
protected ChangeModel makeBufferingChangeModel(long flushDelay)
public BackgroundIterator createBackgroundIterator()
DataModel
null
may be returned. null
protected void notifyDataChange(ASDUAddress asduAddress, InformationObjectAddress informationObjectAddress, Value<?> value, boolean notify)
public void writeCommand(ASDUHeader header, InformationObjectAddress informationObjectAddress, boolean state, byte type, MirrorCommand mirrorCommand, boolean execute)
public void writeFloatValue(ASDUHeader header, InformationObjectAddress informationObjectAddress, float value, byte type, MirrorCommand mirrorCommand, boolean execute)
public void writeScaledValue(ASDUHeader header, InformationObjectAddress informationObjectAddress, short value, byte type, MirrorCommand mirrorCommand, boolean execute)
public com.google.common.util.concurrent.ListenableFuture<Value<?>> read(ASDUAddress asduAddress, InformationObjectAddress address)
DataModel
null
.address
- the address to readnull
if the data model
instantly decide that the value cannot be readprotected Value<?> performRead(ASDUAddress asduAddress, InformationObjectAddress address)
public com.google.common.util.concurrent.ListenableFuture<Void> readAll(ASDUAddress asduAddress, Runnable prepare, DataListener listener)
DataModel
DataListener
.asduAddress
- the ASDU common addressprepare
- a runnable that will be called before the actual processing,
from the same thread the listener will be called. But only
when the request actually can be processed. If the runnable
was called, the method must not return null
.listener
- the data receivernull
if the ASDU address was unknown.protected void performReadAll(ASDUAddress asduAddress, DataListener listener, Map<Integer,Value<?>> map)
public void forAllAsdu(java.util.function.Consumer<ASDUAddress> function, Runnable ifNoneFound)
DataModel
Note that the ASDUs must not change until each function call has been completed.
The function call can be performed asynchronously.
function
- the function to call for each known ASDU addressifNoneFound
- will be called if there are no known common ASDU addresses,
may be null
protected void performForAllAsdu(java.util.function.Consumer<ASDUAddress> function, Runnable ifNoneFound)