|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.comm.eia709.Eia709NetworkVariable
public class Eia709NetworkVariable
The Eia709NetworkVariable
class is the main communication interface
for running EIA-709 controllets. The methods provided allow to read and modify the
current value of a network variable, to propagate the value over the network and
to poll network variables for updates.
A NetworkVariableListener
can be attached to the network variable to
keep updated on value changes and remote write accesses.
In EIA-709, a network variable features a number of properties or modifiers. The term modifier derives from the manner in which network variables are declared in Neuron C. Like in ANSI C, in neuron C modifiers are added to a variable by just writing them in their declaration. The absence of a modifier will cause default behaviour in the functional group.
The folowing table shows the different functional groups, the possible values and default values:
values | default | |
direction | MOD_DIR_OUTGOING , MOD_DIR_INCOMING | MOD_DIR_OUTGOING |
propagation | MOD_SYNC , MOD_POLLED | MOD_SYNC |
const | MOD_CONST | --- |
storage | MOD_RAM , MOD_EEPROM * | MOD_RAM |
service | MOD_SERVICE_UNACKD , MOD_SERVICE_UNACKD_RPT ,
MOD_SERVICE_ACKD | MOD_SERVICE_UNACKD |
service config | MOD_SERVICE_CONFIG *, MOD_SERVICE_NONCONFIG | MOD_SERVICE_NONCONFIG |
priority | MOD_PRIORITY , MOD_NONPRIORITY | MOD_NONPRIORITY |
priority config | MOD_PRIORITY_CONFIG *, MOD_PRIORITY_NONCONFIG | MOD_PRIORITY_NONCONFIG |
authentication | MOD_AUTH *, MOD_NONAUTH | MOD_NONAUTH |
authentication config | MOD_AUTH_CONFIG *, MOD_AUTH_NONCONFIG | MOD_AUTH_NONCONFIG |
NetworkVariableListener
,
NetworkVariableEvent
Field Summary | |
---|---|
static int |
MASK_MOD_DIR
Masks out the direction information from a modifer value. |
static int |
MASK_MOD_SERVICE
Masks out the service bits from a modifier value. |
static int |
MOD_AUTH
Modifier 'autheticated': network variables with this modifier use authenticated datagrams Note: not supported in this version |
static int |
MOD_AUTH_CONFIG
Modifier '(config)' for authentication modifiers: network variable authentication can be changed at runtime (default) Note: not supported in this version |
static int |
MOD_AUTH_NONCONFIG
Modifier '(nonconfig)' for authentication modifiers: network variable authentication can not be changed at runtime (default) Note: not supported in this version |
static int |
MOD_CHANGEABLE_TYPE
Modifier 'changeable_typ': the data type of network variables with this modifier can be changed at runtime Note: not supported in this version |
static int |
MOD_CONST
Modifier 'const': network variables with this modifier cannot be changed locally |
static int |
MOD_DIR_INCOMING
Modifier 'out': network variables with this modifer act as outgoing variables. |
static int |
MOD_DIR_OUTGOING
Modifier 'in': network variables with this modifer act as incoming variables. |
static int |
MOD_EEPROM
Modifier 'eeprom': values of network variables with this modifier are stored in persistant memory Note: not supported in this version |
static int |
MOD_NONAUTH
Modifier 'nonautheticated': network variables with this modifier use non-authenticated datagrams (default) Note: not supported in this version |
static int |
MOD_NONPRIORITY
Modifier 'nonpriority': network variables with this modifier use non-priority datagrams for value transmission (default) |
static int |
MOD_POLLED
Modifier 'polled': network variables with this modifier have to propagated |
static int |
MOD_PRIORITY
Modifier 'priority': network variables with this modifier use priority datagrams for value transmission |
static int |
MOD_PRIORITY_CONFIG
Modifier '(nonconfig)' for priority modifiers: network variable priority can be changed at runtime Note: not supported in this version |
static int |
MOD_PRIORITY_NONCONFIG
Modifier '(nonconfig)' for priority modifiers: network variable priority can not be changed at runtime (default) Note: not supported in this version |
static int |
MOD_RAM
Modifier 'eeprom': values of network variables with this modifier are stored in persistant memory Note: not supported in this version |
static int |
MOD_SERVICE_ACKD
Modifier 'ackd': network variables with this modifier use the ACKD transmission service |
static int |
MOD_SERVICE_CONFIG
Modifier '(config)' for service modifiers: network variable transmission service can be changed at runtime Note: not supported in this version |
static int |
MOD_SERVICE_NONCONFIG
Modifier '(nonconfig)' for service modifiers: network variable transmission service can not be changed at runtime (default) Note: not supported in this version |
static int |
MOD_SERVICE_UNACKD
Modifier 'unackd': network variables with this modifier use the UNACKD transmission service (default) |
static int |
MOD_SERVICE_UNACKD_RPT
Modifier 'unackd_rpt': network variables with this modifier use the UNACKD_RPT transmission service |
static int |
MOD_SYNC
Modifier 'synchronized': network variables with this modifier will be automatically propagated |
static int |
TYPE_SNVT_COLOR
Variable type 'SNVT_color'. |
static int |
TYPE_SNVT_FREQ_F
Variable type 'SNVT_freq_f'. |
static int |
TYPE_SNVT_FREQ_HZ
Variable type 'SNVT_freq_hz'. |
static int |
TYPE_SNVT_SWITCH
Variable type 'SNVT_switch'. |
static int |
TYPE_SNVT_TEMP
Variable type 'SNVT_temp'. |
Constructor Summary | |
---|---|
Eia709NetworkVariable(Eia709Node node,
String identifier,
int type,
int size,
int modifier)
Creates a new network variable default self description. |
|
Eia709NetworkVariable(Eia709Node node,
String identifier,
int type,
int size,
int modifier,
String selfDescription)
Creates a new network variable. |
Method Summary | |
---|---|
Eia709Address |
getAddress()
Returns the address. |
DataInputStream |
getDataInputStream()
Returns a DataInputStream for reading from the network variable value. |
DataOutputStream |
getDataOutputStream()
Returns a DataOutputStream for writing to the network variable value. |
int |
getDataType()
Returns the NVs data type. |
int |
getDirection()
Returns the direction |
String |
getIdString()
Returns the network variable ID string. |
int |
getModifier()
Returns the network variable modifier. |
Eia709Node |
getNode()
Returns the node associated with this network variable. |
int |
getSelector()
Returns selector. |
String |
getSelfDescription()
Returns this network variable's self description. |
byte[] |
getValue()
Returns the current value. |
void |
notifyListeners(NetworkVariableEvent event)
Notify all connected Listeners about an event. |
void |
poll()
Polls the network variable. |
void |
propagate()
Propagates the network variable. |
void |
setAddress(Eia709Address address)
Sets the NVs peer address. |
void |
setListener(NetworkVariableListener listener)
Attaches a listener. |
void |
setSelector(int selector)
Sets the NVs selector. |
void |
setValue(byte[] value)
Sets the value. |
protected void |
updateValue()
Internal method, do not call directly. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, toString, wait |
Field Detail |
---|
public static final int MOD_SYNC
public static final int MOD_POLLED
public static final int MOD_CHANGEABLE_TYPE
public static final int MOD_CONST
public static final int MOD_RAM
public static final int MOD_EEPROM
public static final int MOD_SERVICE_UNACKD
MOD_SERVICE_UNACKD_RPT
,
MOD_SERVICE_ACKD
,
Constant Field Valuespublic static final int MOD_SERVICE_UNACKD_RPT
MOD_SERVICE_UNACKD
,
MOD_SERVICE_ACKD
,
Constant Field Valuespublic static final int MOD_SERVICE_ACKD
MOD_SERVICE_UNACKD
,
MOD_SERVICE_UNACKD_RPT
,
Constant Field Valuespublic static final int MASK_MOD_SERVICE
public static final int MOD_SERVICE_NONCONFIG
MOD_SERVICE_CONFIG
,
Constant Field Valuespublic static final int MOD_SERVICE_CONFIG
MOD_SERVICE_NONCONFIG
,
Constant Field Valuespublic static final int MOD_NONPRIORITY
MOD_PRIORITY
,
Constant Field Valuespublic static final int MOD_PRIORITY
MOD_NONPRIORITY
,
Constant Field Valuespublic static final int MOD_PRIORITY_NONCONFIG
MOD_PRIORITY_CONFIG
,
Constant Field Valuespublic static final int MOD_PRIORITY_CONFIG
MOD_PRIORITY_NONCONFIG
,
Constant Field Valuespublic static final int MOD_NONAUTH
MOD_AUTH
,
Constant Field Valuespublic static final int MOD_AUTH
MOD_NONAUTH
,
Constant Field Valuespublic static final int MOD_AUTH_NONCONFIG
MOD_AUTH_CONFIG
,
Constant Field Valuespublic static final int MOD_AUTH_CONFIG
MOD_AUTH_NONCONFIG
,
Constant Field Valuespublic static final int MASK_MOD_DIR
public static final int MOD_DIR_OUTGOING
public static final int MOD_DIR_INCOMING
public static final int TYPE_SNVT_TEMP
public static final int TYPE_SNVT_COLOR
public static final int TYPE_SNVT_FREQ_F
public static final int TYPE_SNVT_FREQ_HZ
public static final int TYPE_SNVT_SWITCH
Constructor Detail |
---|
public Eia709NetworkVariable(Eia709Node node, String identifier, int type, int size, int modifier)
node
- associated nodeidentifier
- network variable identifier (must not be null)type
- variable type (basic types, SNVTs or UNVTs)size
- value sizemodifier
- variable modifiers (see the list of valid modifiers in this class)public Eia709NetworkVariable(Eia709Node node, String identifier, int type, int size, int modifier, String selfDescription)
node
- associated nodeidentifier
- network variable identifier (must not be null)type
- variable type (basic types, SNVTs or UNVTs)size
- value sizemodifier
- variable modifiers (see the list of valid modifiers in this class)selfDescription
- self description string (may be null)Method Detail |
---|
public void setValue(byte[] value) throws IOException
NetworkVariable
setValue
in interface NetworkVariable
value
- new value
IOException
- in case of I/O errorspublic byte[] getValue()
getValue
in interface NetworkVariable
public void propagate() throws IOException
propagate
in interface NetworkVariable
IOException
public void setListener(NetworkVariableListener listener)
setListener
in interface NetworkVariable
listener
- listenerNetworkVariableEvent
public void notifyListeners(NetworkVariableEvent event)
notifyListeners
in interface NetworkVariable
event
- event to pass to listenerspublic void setSelector(int selector)
selector
- EIA-709 network variable selectorEia709Constants.MIN_NV_SELECTOR
,
Eia709Constants.MAX_NV_SELECTOR
protected void updateValue()
public Eia709Node getNode()
public int getSelector()
public void setAddress(Eia709Address address)
address
- addresspublic Eia709Address getAddress()
public int getDirection()
public int getModifier()
public String getSelfDescription()
public String getIdString()
public int getDataType()
public void poll() throws IOException
poll
in interface NetworkVariable
IOException
public DataOutputStream getDataOutputStream()
propagate()
method.DataOutputStream out = nv.getDataOutputStream(); out.writeInt( 0x123456); // write a 4-byte integer value out.writeFloat( 1.2f); // write a 4-byte floating point value nv.propagate(); // propagate value
getDataOutputStream
in interface NetworkVariable
getDataInputStream()
,
propagate()
public DataInputStream getDataInputStream()
DataInputStream in = nv.getDataInputStream(); int i = in.readInt(); // read a 4-byte integer value float f = in.readFloat(); // read a 4-byte floating point value
getDataInputStream
in interface NetworkVariable
getDataOutputStream()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |