public class IOTag extends Object
IOServer.onGetIoInfo(java.lang.String, java.lang.String)
function.
This call will then be followed by a IOServer.onAdviseIo(com.ewon.ewonitf.IOTag)
and the Tag will have to be managed by the IO Server until
an IOServer.onUnadviseIo(com.ewon.ewonitf.IOTag)
call is issued from the eWON Core.Modifier and Type | Field and Description |
---|---|
static int |
QUALITY_BAD
Used in
setQuality(int) to define if the tag quality is NOT ok. |
static int |
QUALITY_GOOD
Used in
setQuality(int) to define if the tag quality is ok. |
Constructor and Description |
---|
IOTag(String topicName,
String ioName,
int defaultDataType,
boolean isOutput)
The IOTag object is used to manage one tag in the IOServer.
The user will need to instantiate this type of object in the IOServer.onGetIoInfo(java.lang.String, java.lang.String)
implementation. |
Modifier and Type | Method and Description |
---|---|
void |
adviseTag(int postChangeId,
int adviseDataType)
Internal: This function is called automatically before the
IOServer.onAdviseIo(com.ewon.ewonitf.IOTag)
function is called in you IOServer.You do not need to call this function. |
int |
getAdviseDataType() |
int |
getAdviseResId()
Internal.
|
void |
getData(IOValue ioData)
This function must be called to change the internal IOTag value according to the value in an
IOValue object
which is used to exchange tag values with the eWON core.You cannot directly pass the value to the eWON core, instead you need to use the IOValue object to do so. |
int |
getDefaultDataType() |
IOValue |
getIoData() |
String |
getIoName() |
int |
getPostChangeId()
Required to call
IOServer.postIoChange(com.ewon.ewonitf.IOTag) . |
int |
getQuality() |
String |
getTopicName() |
boolean |
getValueBoolean()
This function is used to retreive the current tag's value if defaultDataType is
IOValue.DATATYPE_BOOLEAN . |
float |
getValueFloat32()
This function is used to retreive the current tag's value if defaultDataType is
IOValue.DATATYPE_FLOAT32 . |
int |
getValueInt32()
This function is used to retreive the current tag's value if defaultDataType is
IOValue.DATATYPE_INT32 . |
long |
getValueUInt32()
This function is used to retreive the current tag's value if defaultDataType is
IOValue.DATATYPE_UINT32 . |
boolean |
isAdvised()
Indicates if the tag
adviseTag(int, int) function was already called or not. |
boolean |
isOutput() |
void |
setQuality(int q)
Assign the current tag quality value.
To propagate the quality change to the eWON Core, you also need to call the IOServer.postQuality(com.ewon.ewonitf.IOTag) after
the tag's quality has been set by this function. |
void |
setValueBoolean(boolean value)
This function must be called to update the internal IOTag value of the tag if defaultDataType is
IOValue.DATATYPE_BOOLEAN . |
void |
setValueFloat32(float value)
This function must be called to update the internal IOTag value of the tag if defaultDataType is
IOValue.DATATYPE_FLOAT32 . |
void |
setValueInt32(int value)
This function must be called to update the internal IOTag value of the tag if defaultDataType is
IOValue.DATATYPE_INT32 . |
void |
setValueUInt32(long value)
This function must be called to update the internal IOTag value of the tag if defaultDataType is
IOValue.DATATYPE_UINT32 . |
void |
unAdviseTag()
Internal: This function is called automatically after the
IOServer.onUnadviseIo(com.ewon.ewonitf.IOTag)
function is called in you IOServer.You do not need to call this function. |
void |
updateTag(IOValue ioData)
This function must be called to write the internal IOTag value in an
IOValue object
which is used to exchange tag values with the eWON core.You cannot directly pass the value to the eWON core, instead you need to use the IOValue object to do so. |
public static final int QUALITY_GOOD
setQuality(int)
to define if the tag quality is ok.public static final int QUALITY_BAD
setQuality(int)
to define if the tag quality is NOT ok.public IOTag(String topicName, String ioName, int defaultDataType, boolean isOutput)
IOServer.onGetIoInfo(java.lang.String, java.lang.String)
implementation. When onGetIoInfo is called, the topicName and IOName are provided, the
user must determine the default datatype for the tag and if the tag is writable (isOutput).
We only care about the tags which are "advised", this means that they have been registered by the
eWON and the eWON needs to be alerted about any change on the tag.topicName
- ioName
- defaultDataType
- This is type which is closer to the actual value stored in the tag.isOutput
- Indicates if this tag can be written by the eWON application. False if the tag is read-only.
For example if the tag is connected to a digital input, it will be isOutput == false.public boolean isAdvised()
adviseTag(int, int)
function was already called or not.public String getTopicName()
IOTag()
).public boolean isOutput()
IOTag()
).public int getDefaultDataType()
IOTag()
).public void adviseTag(int postChangeId, int adviseDataType)
IOServer.onAdviseIo(com.ewon.ewonitf.IOTag)
function is called in you IOServer.postChangeId
- Passed during onAdviseIo
adviseDataType
- Passed during onAdviseIo
public void unAdviseTag()
IOServer.onUnadviseIo(com.ewon.ewonitf.IOTag)
function is called in you IOServer.isAdvised()
.public IOValue getIoData() throws Exception
Exception
- in case the internal representation cannot be converted to the internal IOValue.public int getAdviseDataType()
public int getAdviseResId()
public int getQuality()
setQuality(int)
, defaults to QUALITY_GOOD
after creation.public void setQuality(int q) throws Exception
IOServer.postQuality(com.ewon.ewonitf.IOTag)
after
the tag's quality has been set by this function.q
- on of QUALITY_GOOD
or QUALITY_BAD
Exception
- if quality passed is invalid.public int getPostChangeId()
IOServer.postIoChange(com.ewon.ewonitf.IOTag)
. The postChangeId is passed during tag Advise and saved with
#setAdviseInfo
. The value can then be retreived with this function.#setAdviseInfo
.public void setValueUInt32(long value) throws Exception
IOValue.DATATYPE_UINT32
.
IOTag
requires to maintains internally the tag value. Thus, you need to call one of the
setValueXXX and getValueXX to read and write the tag value.defaultDataType
passed during IOTag
creation, if you fail to call the right setValueXXX an exception will be thrown.value
- The new tag's value.Exception
- In case the defaultDataType passed to IOTag#IOTag(int, boolean)
is not IOValue.DATATYPE_UINT32
.public void setValueInt32(int value) throws Exception
IOValue.DATATYPE_INT32
.
IOTag
requires to maintains internally the tag value. Thus, you need to call one of the
setValueXXX and getValueXX to read and write the tag value.defaultDataType
passed during IOTag
creation, if you fail to call the right setValueXXX an exception will be thrown.value
- The new tag's value.Exception
- In case the defaultDataType passed to IOTag#IOTag(int, boolean)
is not IOValue.DATATYPE_INT32
.public void setValueFloat32(float value) throws Exception
IOValue.DATATYPE_FLOAT32
.
IOTag
requires to maintains internally the tag value. Thus, you need to call one of the
setValueXXX and getValueXX to read and write the tag value.defaultDataType
passed during IOTag
creation, if you fail to call the right setValueXXX an exception will be thrown.value
- The new tag's value.Exception
- In case the defaultDataType passed to IOTag#IOTag(int, boolean)
is not IOValue.DATATYPE_FLOAT32
.public void setValueBoolean(boolean value) throws Exception
IOValue.DATATYPE_BOOLEAN
.
IOTag
requires to maintains internally the tag value. Thus, you need to call one of the
setValueXXX and getValueXX to read and write the tag value.defaultDataType
passed during IOTag
creation, if you fail to call the right setValueXXX an exception will be thrown.value
- The new tag's value.Exception
- In case the defaultDataType passed to IOTag#IOTag(int, boolean)
is not IOValue.DATATYPE_BOOLEAN
.public long getValueUInt32() throws Exception
IOValue.DATATYPE_UINT32
.
You need to use the setValueXXX according to the defaultDataType
passed during IOTag
creation, if you fail to call the right setValueXXX an exception will be thrown.Exception
- In case the defaultDataType passed to IOTag#IOTag(int, boolean)
is not IOValue.DATATYPE_UINT32
.public int getValueInt32() throws Exception
IOValue.DATATYPE_INT32
.
You need to use the setValueXXX according to the defaultDataType
passed during IOTag
creation, if you fail to call the right setValueXXX an exception will be thrown.Exception
- In case the defaultDataType passed to IOTag#IOTag(int, boolean)
is not IOValue.DATATYPE_INT32
.public float getValueFloat32() throws Exception
IOValue.DATATYPE_FLOAT32
.
You need to use the setValueXXX according to the defaultDataType
passed during IOTag
creation, if you fail to call the right setValueXXX an exception will be thrown.Exception
- In case the defaultDataType passed to IOTag#IOTag(int, boolean)
is not IOValue.DATATYPE_FLOAT32
.public boolean getValueBoolean() throws Exception
IOValue.DATATYPE_BOOLEAN
.
You need to use the setValueXXX according to the defaultDataType
passed during IOTag
creation, if you fail to call the right setValueXXX an exception will be thrown.Exception
- In case the defaultDataType passed to IOTag#IOTag(int, boolean)
is not IOValue.DATATYPE_BOOLEAN
.public void updateTag(IOValue ioData) throws Exception
IOValue
object
which is used to exchange tag values with the eWON core.ioData
- Opaque object used to exchange tag values with the eWON core. The IOTag's value will be written in this ioData.Exception
- In case the defaultDataType is not set or the adviseDataType is not set.public void getData(IOValue ioData) throws Exception
IOValue
object
which is used to exchange tag values with the eWON core.ioData
- Opaque object used to exchange tag values with the eWON core. The IOTag's value will be changed according to this ioData.Exception
- In case the defaultDataType is not set or the adviseDataType is not set.