Class AlarmData
java.lang.Object
org.osgi.service.dal.FunctionData
org.osgi.service.dal.functions.data.AlarmData
- All Implemented Interfaces:
Comparable<Object>
Function alarm data. It cares about the alarm type, severity, timestamp and
additional metadata. It doesn't support unit. The alarm type is mapped to
FunctionData
value.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Represents the severity field name.static final String
Represents the type field name.static final int
The severity rating indicates that there a critical alarm.static final int
The severity rating indicates that there is a major alarm.static final int
The severity rating indicates that there is a minor alarm.static final int
The severity constant indicates that there is no severity rating for this alarm.static final int
The alarm type indicates that there is access control issue.static final int
The alarm type indicates that there is a burglar notification.static final int
The alarm type indicates that temperature is too low.static final int
The alarm type indicates that carbon monoxide (CO) is detected.static final int
The alarm type indicates that carbon dioxide (CO2) is detected.static final int
The alarm type indicates that there is hardware failure.static final int
The alarm type indicates that temperature is too high.static final int
The alarm type indicates a power cut.static final int
The alarm type indicates that smoke is detected.static final int
The alarm type indicates that there is software failure.static final int
The alarm type for a tamper indication.static final int
The alarm type indicates that the type is not specified.static final int
The alarm type indicates that a water leak is detected.Fields inherited from class org.osgi.service.dal.FunctionData
DESCRIPTION, FIELD_METADATA, FIELD_TIMESTAMP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Compares thisAlarmData
instance with the given argument.boolean
TwoAlarmData
instances are equal if they contain equal metadata, timestamp, type and severity.int
Returns the alarm severity.int
getType()
Returns the alarm type.int
hashCode()
Returns the hash code for thisAlarmData
object.toString()
Returns the string representation of this alarm data.Methods inherited from class org.osgi.service.dal.FunctionData
getMetadata, getTimestamp
-
Field Details
-
FIELD_SEVERITY
Represents the severity field name. The field value is available withgetSeverity()
. The field type isint
. The constant can be used as a key toAlarmData(Map)
.- See Also:
-
FIELD_TYPE
Represents the type field name. The field value is available withgetType()
. The field type isint
. The constant can be used as a key toAlarmData(Map)
.- See Also:
-
TYPE_UNDEFINED
public static final int TYPE_UNDEFINEDThe alarm type indicates that the type is not specified.- See Also:
-
TYPE_ACCESS_CONTROL
public static final int TYPE_ACCESS_CONTROLThe alarm type indicates that there is access control issue. For example, the alarm can indicate that the door is unlocked.- See Also:
-
TYPE_BURGLAR
public static final int TYPE_BURGLARThe alarm type indicates that there is a burglar notification. For example, the alarm can indicate that the glass is broken.- See Also:
-
TYPE_COLD
public static final int TYPE_COLDThe alarm type indicates that temperature is too low.- See Also:
-
TYPE_GAS_CO
public static final int TYPE_GAS_COThe alarm type indicates that carbon monoxide (CO) is detected.- See Also:
-
TYPE_GAS_CO2
public static final int TYPE_GAS_CO2The alarm type indicates that carbon dioxide (CO2) is detected.- See Also:
-
TYPE_HEAT
public static final int TYPE_HEATThe alarm type indicates that temperature is too high.- See Also:
-
TYPE_HARDWARE_FAIL
public static final int TYPE_HARDWARE_FAILThe alarm type indicates that there is hardware failure.- See Also:
-
TYPE_POWER_FAIL
public static final int TYPE_POWER_FAILThe alarm type indicates a power cut.- See Also:
-
TYPE_SMOKE
public static final int TYPE_SMOKEThe alarm type indicates that smoke is detected.- See Also:
-
TYPE_SOFTWARE_FAIL
public static final int TYPE_SOFTWARE_FAILThe alarm type indicates that there is software failure.- See Also:
-
TYPE_TAMPER
public static final int TYPE_TAMPERThe alarm type for a tamper indication.- See Also:
-
TYPE_WATER
public static final int TYPE_WATERThe alarm type indicates that a water leak is detected.- See Also:
-
SEVERITY_UNDEFINED
public static final int SEVERITY_UNDEFINEDThe severity constant indicates that there is no severity rating for this alarm.- See Also:
-
SEVERITY_MINOR
public static final int SEVERITY_MINORThe severity rating indicates that there is a minor alarm. The severity priority is lower thanSEVERITY_MAJOR
andSEVERITY_CRITICAL
.- See Also:
-
SEVERITY_MAJOR
public static final int SEVERITY_MAJORThe severity rating indicates that there is a major alarm. The severity priority is higher thanSEVERITY_MINOR
and lower thanSEVERITY_CRITICAL
.- See Also:
-
SEVERITY_CRITICAL
public static final int SEVERITY_CRITICALThe severity rating indicates that there a critical alarm. The severity priority is higher thanSEVERITY_MINOR
andSEVERITY_MAJOR
.- See Also:
-
-
Constructor Details
-
AlarmData
Constructs newAlarmData
instance with the specified field values. The map keys must match to the field names. The map values will be assigned to the appropriate class fields. For example, the maps can be: {"severity"=Integer(1)...}. That map will initialize theFIELD_SEVERITY
field with 1. If severity is missing,SEVERITY_UNDEFINED
is used.FIELD_SEVERITY
- optional field. The value type must beInteger
.FIELD_TYPE
- optional field. The value type must beInteger
.
- Parameters:
fields
- Contains the newAlarmData
instance field values.- Throws:
ClassCastException
- If the field value types are not expected.IllegalArgumentException
- If the alarm severity is invalid.NullPointerException
- If the fields map isnull
.
-
AlarmData
Constructs newAlarmData
instance with the specified arguments.- Parameters:
timestamp
- The alarm data timestamp optional field.metadata
- The alarm data metadata optional field.severity
- The alarm data severity optional field.type
- The alarm data type optional field.- Throws:
IllegalArgumentException
- If the alarm severity is invalid.
-
-
Method Details
-
getType
public int getType()Returns the alarm type. The type can be one of the predefined: Zero and positive values are reserved for this definition and further extensions of the alarm types. Custom types can be used only as negative values to prevent potential collisions.- Returns:
- The alarm type.
-
getSeverity
public int getSeverity()Returns the alarm severity. The severity can be one of:- Returns:
- The alarm severity.
-
equals
TwoAlarmData
instances are equal if they contain equal metadata, timestamp, type and severity.- Overrides:
equals
in classFunctionData
- Parameters:
o
- The object to compare this data.- Returns:
true
if this object is equivalent to the specified one.- See Also:
-
hashCode
public int hashCode()Returns the hash code for thisAlarmData
object. The hash code is a sum ofFunctionData.hashCode()
, the alarm severity and the alarm type.- Overrides:
hashCode
in classFunctionData
- Returns:
- The hash code of this
AlarmData
object. - See Also:
-
compareTo
Compares thisAlarmData
instance with the given argument. If the argument is notAlarmData
, it throwsClassCastException
. Otherwise, this method returns:-1
if this instance field is less than a field of the specified argument.0
if all fields are equivalent.1
if this instance field is greater than a field of the specified argument.
- Specified by:
compareTo
in interfaceComparable<Object>
- Overrides:
compareTo
in classFunctionData
- Parameters:
o
-AlarmData
to be compared.- Returns:
-1
,0
or1
depending on the comparison rules.- Throws:
ClassCastException
- If the method argument is not of typeAlarmData
.- See Also:
-
toString
Returns the string representation of this alarm data.
-