eWON JTK

com.ewon.ewonitf
Class TagControl

java.lang.Object
  extended by com.ewon.ewonitf.TagControl
Direct Known Subclasses:
EvtTagListener

public class TagControl
extends Object

This class represents an eWON tag.
It can be used to access the tag value or the tag alarm status.
It can also be used to force historical loggin and acknowledge alarm.
For tag creation and reconfiguration, the SysControlBlock should be used.
The TagControl object is also used for defining tag events handling in the DefaultEventHandler.


Field Summary
static int ALARM_STATUS_ACK
          Alarm status value when an alarm is active (and it IS acknowledged), see getAlarmType()
static int ALARM_STATUS_ALM
          Alarm status value when an alarm is active (and not acknowledged), see getAlarmType()
static int ALARM_STATUS_NONE
          Alarm status value when no alarm is pending, see getAlarmType()
static int ALARM_STATUS_RTN
          Alarm status value when an alarm has returned to normal (but not acknowledged), see getAlarmType()
static int ALARM_TYPE_HIGH
          Alarm type value when no alarm is active with level HIGH, see getAlarmStatus()
static int ALARM_TYPE_HIGH_HIGH
          Alarm type value when no alarm is active with level HIGH HIGH, see getAlarmStatus()
static int ALARM_TYPE_LEVEL
          Alarm type value when no alarm is active with boolean level, see getAlarmStatus()
static int ALARM_TYPE_LOW
          Alarm type value when no alarm is active with level LOW, see getAlarmStatus()
static int ALARM_TYPE_LOW_LOW
          Alarm type value when no alarm is active with level LOW LOW, see getAlarmStatus()
static int ALARM_TYPE_NONE
          Alarm type value when no alarm is pending, see getAlarmStatus()
static byte BY_ID
          ReferenceType for TagControl(int,int) indicating if that the refence to the tag is its ID.
static byte BY_NDX
          ReferenceType for TagControl(int,int) indicating if that the refence to the tag is its index (starting at 0).
 
Constructor Summary
TagControl()
          This constructor creates an unamned tag control object.
TagControl(int TagId)
          Creates an instance of TagControl associated to the given Tag ID.
TagControl(int TagRefType, int TagRef)
          Creates a new instance of TagControl associated to Tag NDX or Tag ID.
TagControl(String TagName)
          Creates a new instance of TagControl associated to a Tag Name.
 
Method Summary
 void ackAlarm()
          Used to acknowledge an active alarm.
The alarm will appear in the alarm history log as acknowledged by the administrator.
See also ackAlarm(java.lang.String)
 void ackAlarm(String userLogin)
          Used to acknowledge an active alarm.
The userLogin provided will appear in the alarm log.
 int getAlarmStatus()
          Read the current alarm status for the tag.
 int getAlarmType()
          Read the current alarm type for the tag.
 int getTagId()
          Return the ID of tag associated to this TagControl instance.
 String getTagName()
          Return the Name of tag associated to this TagControl instance.
 double getTagValueAsDouble()
          Read tag value and return value as Double.
 long getTagValueAsLong()
          Read tag value and return value as Long.
 void logTag()
          Force historical logging of the tags current value.
 void setTagId(int TagId)
          Associates the TagControl instance with a tag by the tag's ID.
Remark: success of this call does not mean that the given TagId is actually valid.
 void setTagName(String TagName)
          Associates the TagControl instance with a tag by the tag's name.
 void setTagValueAsDouble(double value)
          Change the tag value with Double value.
 void setTagValueAsInt(int value)
          Change the tag value with Integer value.
 void setTagValueAsLong(long value)
          Change the tag value with Long value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BY_NDX

public static final byte BY_NDX
ReferenceType for TagControl(int,int) indicating if that the refence to the tag is its index (starting at 0).

See Also:
Constant Field Values

BY_ID

public static final byte BY_ID
ReferenceType for TagControl(int,int) indicating if that the refence to the tag is its ID.

See Also:
Constant Field Values

ALARM_STATUS_NONE

public static final int ALARM_STATUS_NONE
Alarm status value when no alarm is pending, see getAlarmType()

See Also:
Constant Field Values

ALARM_STATUS_ALM

public static final int ALARM_STATUS_ALM
Alarm status value when an alarm is active (and not acknowledged), see getAlarmType()

See Also:
Constant Field Values

ALARM_STATUS_ACK

public static final int ALARM_STATUS_ACK
Alarm status value when an alarm is active (and it IS acknowledged), see getAlarmType()

See Also:
Constant Field Values

ALARM_STATUS_RTN

public static final int ALARM_STATUS_RTN
Alarm status value when an alarm has returned to normal (but not acknowledged), see getAlarmType()

See Also:
Constant Field Values

ALARM_TYPE_NONE

public static final int ALARM_TYPE_NONE
Alarm type value when no alarm is pending, see getAlarmStatus()

See Also:
Constant Field Values

ALARM_TYPE_HIGH

public static final int ALARM_TYPE_HIGH
Alarm type value when no alarm is active with level HIGH, see getAlarmStatus()

See Also:
Constant Field Values

ALARM_TYPE_LOW

public static final int ALARM_TYPE_LOW
Alarm type value when no alarm is active with level LOW, see getAlarmStatus()

See Also:
Constant Field Values

ALARM_TYPE_LEVEL

public static final int ALARM_TYPE_LEVEL
Alarm type value when no alarm is active with boolean level, see getAlarmStatus()

See Also:
Constant Field Values

ALARM_TYPE_HIGH_HIGH

public static final int ALARM_TYPE_HIGH_HIGH
Alarm type value when no alarm is active with level HIGH HIGH, see getAlarmStatus()

See Also:
Constant Field Values

ALARM_TYPE_LOW_LOW

public static final int ALARM_TYPE_LOW_LOW
Alarm type value when no alarm is active with level LOW LOW, see getAlarmStatus()

See Also:
Constant Field Values
Constructor Detail

TagControl

public TagControl(int TagId)
Creates an instance of TagControl associated to the given Tag ID. The TagControl object can be created without any association with a specific tag. The Tag association can be defined later on by using the setTagId(int) function.

Parameters:
TagId - This is the ID of the the Tag that needs to be mapped.

TagControl

public TagControl(int TagRefType,
                  int TagRef)
           throws EWException
Creates a new instance of TagControl associated to Tag NDX or Tag ID. This constructor must be used to define the tag association using Tag ID or Tag Index. For association by Tag ID, the TagControl(int) function can be used also.

Parameters:
TagRefType - This field defines the type of reference passed (either BY_NDX, BY_ID)
TagRef - This is an ID or an index according to TagRefType
Throws:
EWException - In case of invalid Tag NDX.

TagControl

public TagControl(String TagName)
           throws EWException
Creates a new instance of TagControl associated to a Tag Name. This constructor must be used to create an association between a TagControl and a Tag by specifying the Tag's name.

Parameters:
TagName - The tag's name. The given tag must exist.
Throws:
EWException - In case the operation fails.

TagControl

public TagControl()
This constructor creates an unamned tag control object. The object cannot manipulate a tag until the setTagId(int) or setTagName(java.lang.String) function has been called This allows to dynamically reuse a TagControl object for multiple tags.

Method Detail

getTagId

public int getTagId()
Return the ID of tag associated to this TagControl instance.

Returns:
Tag ID.

getTagName

public String getTagName()
Return the Name of tag associated to this TagControl instance.

Returns:
Tag name.

getTagValueAsDouble

public double getTagValueAsDouble()
Read tag value and return value as Double.

Returns:
Tag value converted to Double.

getTagValueAsLong

public long getTagValueAsLong()
Read tag value and return value as Long.

Returns:
Tag value converted to Long.

setTagValueAsDouble

public void setTagValueAsDouble(double value)
                         throws EWException
Change the tag value with Double value.

Parameters:
value - New value of the tag. This value will be converted to the actual tag type.
Throws:
EWException

setTagValueAsLong

public void setTagValueAsLong(long value)
                       throws EWException
Change the tag value with Long value.

Parameters:
value - New value of the tag. This value will be converted to the actual tag type.
Throws:
EWException

setTagValueAsInt

public void setTagValueAsInt(int value)
                      throws EWException
Change the tag value with Integer value.

Parameters:
value - New value of the tag. This value will be converted to the actual tag type.
Throws:
EWException

logTag

public void logTag()
            throws EWException
Force historical logging of the tags current value. If the tag logging is not enabled, this function has no action.

Throws:
EWException

ackAlarm

public void ackAlarm(String userLogin)
              throws EWException
Used to acknowledge an active alarm.
The userLogin provided will appear in the alarm log.

Parameters:
userLogin - This user will appear as having acknowledged the alarm in the alarm history log.
See also ackAlarm()
Throws:
EWException

ackAlarm

public void ackAlarm()
              throws EWException
Used to acknowledge an active alarm.
The alarm will appear in the alarm history log as acknowledged by the administrator.
See also ackAlarm(java.lang.String)

Throws:
EWException

getAlarmStatus

public int getAlarmStatus()
                   throws EWException
Read the current alarm status for the tag.

Returns:
The current alarm status. Value is one of ALARM_STATUS_NONE, ALARM_STATUS_ALM,ALARM_STATUS_ACK,ALARM_STATUS_RTN.
Throws:
EWException

getAlarmType

public int getAlarmType()
                 throws EWException
Read the current alarm type for the tag.

Returns:
The current alarm type. Value is one of ALARM_TYPE_NONE,ALARM_TYPE_HIGH,ALARM_TYPE_LOW, ALARM_TYPE_LEVEL,ALARM_TYPE_HIGH_HIGH,ALARM_TYPE_LOW_LOW.
Throws:
EWException

setTagId

public void setTagId(int TagId)
Associates the TagControl instance with a tag by the tag's ID.
Remark: success of this call does not mean that the given TagId is actually valid.

Parameters:
TagId - The ID of the tag the instance must be associated with.

setTagName

public void setTagName(String TagName)
Associates the TagControl instance with a tag by the tag's name.

Parameters:
TagName - The name of the tag the instance must be associated with.

eWON JTK

www.eWON.biz: Your Eyes Watching Over Net