Concrete function interfaces are used to unify the access and the control of the basic device operations and the related properties. The current section specifies the minimal set of such functionalities. They can be extended or replaced to cover domain specific scenarios. The set is not closed and can be incorporated with vendor specific functions. There is support for: control, monitoring and metering information.
BooleanControl function provides a binary control support. The property eventing must follow the definition of Device Abstraction Layer, Function Property Events. The full function definition is available in the next tables.
Table 142.1 BooleanControl Operations
Name | Description |
---|---|
inverse |
Reverses the BooleanControl state. If the
current state represents true value, it'll be
changed to false . If the current state represents
false value, it'll be changed to
true .
|
setTrue |
Sets the BooleanControl state to
true value.
|
setFalse |
Sets the BooleanControl state to
false value.
|
Table 142.2 BooleanControl Properties
Name | Description |
---|---|
data |
Contains the current state of
BooleanControl . The property access is readable,
writable and eventable.
|
Different types can be used as a value of SERVICE_TYPE service property. The next list contains some
suitable to BooleanControl
:
-
LIGHT - indicates that there is a light device control.
true
state means that the light device will be turned on.false
state means that the light device will be turned off. -
DOOR - indicates that there is a door position control.
true
state means that the door will be opened.false
state means that the door will be closed. -
WINDOW - indicates that there is a window position control.
true
state means that the window will be opened.false
state means that the window will be closed. -
POWER - indicates that there is electricity control.
true
state means that the power will be restored.false
state means that the power will be cut. -
other type defined in Types
-
vendor specific
The function is using BooleanData data structure to provide the control state.
The next code snippet sets to true
all
BooleanControl
functions, which control the light.
ServiceReference[] booleanControlSRefs = context.getServiceReferences(
BooleanControl.class.getName(),
'(' + Function.SERVICE_TYPE + '=' + Types.LIGHT + ')');
if (booleanControlSRefs != null) {
for (int i = 0; i < booleanControlSRefs.length; i++) {
BooleanControl booleanControl = (BooleanControl) context.getService(
booleanControlSRefs[i]);
if (booleanControl != null) {
booleanControl.setTrue();
context.ungetService(booleanControlSRefs[i]);
}
}
}
BooleanSensor function provides binary sensor monitoring. It reports the state when an important event is available. There are no operations. The property eventing must follow the definition of Device Abstraction Layer, Function Property Events. The full function definition is available in the next table.
Table 142.3 BooleanSensor Properties
Name | Description |
---|---|
data |
Contains the current state of BooleanSensor .
The property access is readable and eventable.
|
Different types can be used as a value of SERVICE_TYPE service property. The next list contains some
suitable to BooleanSensor
:
-
LIGHT - indicates that the
BooleanSensor
can detected light.true
state means that there is light.false
state means that there is no light. -
GAS - indicates that the
BooleanSensor
supports gas detection.true
state means there is gas.false
state means that there is no gas. -
SMOKE - indicates that the
BooleanSensor
can detect smoke.true
state means that there is smoke.false
state means that there is no smoke. -
DOOR - indicates that the
BooleanSensor
can detect the door state.true
state means that the door is opened.false
state means that the door is closed. -
WINDOW - indicates that the
BooleanSensor
can window state.true
state means that the window is opened.false
state means that the window is closed. -
POWER - indicates that the
BooleanSensor
can detect power/no power.true
state means that there is power.false
state means that there is no power. -
RAIN - indicates that the
BooleanSensor
can detect rain.true
state means that there is rain.false
state means that there is no rain. -
CONTACT - indicates that the
BooleanSensor
can detect contact.true
state means that there is contact.false
state means that there is no contact. -
FIRE - indicates that the
BooleanSensor
can detect fire.true
state means that there is fire.false
state means that there is no fire. -
OCCUPANCY - indicates that the
BooleanSensor
can detect presence.true
state means that someone is detected.false
state means that nobody is detected. -
WATER - indicates that the
BooleanSensor
can detect water leak.true
state means that there is water leak.false
state means that there is no water leak. -
MOTION - indicates that the
BooleanSensor
can detect motion.true
state means that there is motion detection.false
state means that there is no motion detection. -
other type defined in Types
-
vendor specific
The function is using BooleanData data structure to provide the sensor state.
MultiLevelControl function provides multi-level control support. The property eventing must follow the definition of Device Abstraction Layer, Function Property Events. The full function definition is available in the next table.
Table 142.4 MultiLevelControl Properties
Name | Description |
---|---|
data |
Contains the current state of
MultiLevelControl . The property access is readable,
writable and eventable.
|
Different types can be used as a value of SERVICE_TYPE service property. The next list contains some
suitable to MultiLevelControl
:
-
LIGHT - indicates that the
MultiLevelControl
can control light devices. Usually, such devices are called dimmable.MultiLevelControl
minimum value can switch off the device andMultiLevelControl
maximum value can increase the device light to the maximum possible value. -
TEMPERATURE - indicates that the
MultiLevelControl
can control temperature devices. For example, such device can be thermostat.MultiLevelControl
minimum value is the lowest supported temperature.MultiLevelControl
maximum value is the highest supported temperature. -
FLOW - indicates that the
MultiLevelControl
can control the flow level.MultiLevelControl
minimum value is the minimum supported flow level.MultiLevelControl
maximum value is the maximum supported flow level. -
PRESSURE - indicates that the
MultiLevelControl
can control the pressure level.MultiLevelControl
minimum value is the lowest supported pressure level.MultiLevelControl
maximum value is the highest supported pressure level. -
HUMIDITY - indicates that the
MultiLevelControl
can control the humidity level. It's typical functionality for HVAC (heating, ventilation, and air conditioning) devices.MultiLevelControl
minimum value is the lowest supported humidity level.MultiLevelControl
maximum value is the highest supported humidity level. -
GAS - indicates that the
MultiLevelControl
can control the gas level.MultiLevelControl
minimum value is the lowest supported gas level.MultiLevelControl
maximum value is the highest supported gas level. -
SMOKE - indicates that the
MultiLevelControl
can control the smoke level.MultiLevelControl
minimum value is the lowest supported smoke level.MultiLevelControl
maximum value is the highest supported smoke level. -
DOOR - indicates that the
MultiLevelControl
can control the door position.MultiLevelControl
minimum value can completely close the door.MultiLevelControl
maximum value can open the door to the maximum allowed position. -
WINDOW - indicates that the
MultiLevelControl
can control the window position.MultiLevelControl
minimum value can completely close the window.MultiLevelControl
maximum value can open the window to the maximum allowed position. -
LIQUID - indicates that the
MultiLevelControl
can control the liquid level.MultiLevelControl
minimum value is the lowest supported liquid level.MultiLevelControl
maximum value is the highest supported liquid level. -
POWER - indicates that the
MultiLevelControl
can control the power level.MultiLevelControl
minimum value is the lowest supported power level.MultiLevelControl
maximum value is the highest supported power level. -
NOISINESS - indicates that the
MultiLevelControl
can control the noise level.MultiLevelControl
minimum value is the lowest supported noise level.MultiLevelControl
maximum value is the highest supported noise level. -
other type defined in Types
-
vendor specific
The function is using LevelData data structure to provide the level.
MultiLevelSensor function provides multi-level sensor monitoring. It reports its state when an important event is available. There are no operations. The property eventing must follow the definition of Device Abstraction Later, Function Property Events. The full function definition is available in the next table.
Table 142.5 MultiLevelSensor Properties
Name | Description |
---|---|
data |
Contains the current state of
MultiLevelSensor . The property access is readable
and eventable.
|
Different types can be used as a value of SERVICE_TYPE service property. The next list contains some
suitable to MultiLevelSensor
:
-
LIGHT - indicates that the sensor can monitor the light level.
-
TEMPERATURE - indicates that the sensor can monitor the temperature.
-
FLOW - indicates that the sensor can monitor the flow level.
-
PRESSURE - indicates that the sensor can monitor the pressure level.
-
HUMIDITY - indicates that the sensor can monitor the humidity level.
-
GAS - indicates that the sensor can monitor the gas level.
-
SMOKE - indicates that the sensor can monitor the smoke level.
-
DOOR - indicates that the sensor can monitor the door position.
-
WINDOW - indicates that the sensor can monitor the window position.
-
LIQUID - indicates that the sensor can monitor the liquid level.
-
POWER - indicates that the sensor can monitor the power level.
-
NOISINESS - indicates that the sensor can monitor the noise level.
-
RAIN - indicates that the
MultiLevelSensor
can monitor the rain rate. -
other type defined in Types
-
vendor specific
The function is using LevelData data structure to provide the level.
Meter function can measure metering information. It provides the current and total consumptions or generations. The property eventing must follow the definition of Device Abstraction Later, Function Property Events. The full function definition is available in the next tables.
Table 142.6 Meter Properties
Name | Description |
---|---|
total |
Contains the total consumption or production. The property access is readable and eventable. |
current |
Contains the current consumption or production. The property access is readable and eventable. |
Different types can be used as a value of SERVICE_TYPE service property. The next list contains some
suitable to Meter
:
-
PRESSURE - indicates that the
Meter
measures pressure. -
GAS - indicates that the
Meter
measures the gas consumption. -
POWER - indicates that the
Meter
measures the power consumption. -
WATER - indicates that the
Meter
measures water consumption. -
HEAT - indicates that the
Meter
measures thermal energy provided by a source. -
COLD - indicates that the
Meter
measures thermal energy provided by a source. -
other type defined in Types
-
vendor specific
The function is using LevelData data structure to provide metering information.
Meter
function service can be optionally registered
with SERVICE_FLOW service property. The value type is
java.lang.String
. It contains the metering flow. Currently,
the flow can be FLOW_IN for a consumption or FLOW_OUT for a production.
Alarm function provides alarm sensor support. There is only one eventable property and no operations. The property eventing must follow the definition of Device Abstraction Layer, Function Property Events. The full function definition is available in the next table.
Table 142.7 BooleanSensor Properties
Name | Description |
---|---|
alarm |
Specifies the alarm property name. The property is eventable. |
The function is using AlarmData data structure to report the alarm. The property eventing must follow the definition of Device Abstraction Layer, Function Property Events.
Keypad function provides support for keypad control. The keypad typically consists of one or more keys/buttons, which can be discerned. Different types of key presses like short and long press can typically also be detected. Each key pressed event is followed by a key released event. It's not possible to have two consecutive key pressed or key released events. There is only one eventable property and no operations. The property eventing must follow the definition of Device Abstraction Layer, Function Property Events. The full function definition is available in the next table.
Table 142.8 Keypad Properties
Name | Description |
---|---|
key |
Specifies a property name for a key from the keypad. The property is eventable. |
The function is using KeypadData data structure to report the keys.
WakeUp function provides device awake monitoring. It's especially applicable to battery-operated devices. Such device can notify the system that it's awake and can receive commands with a PROPERTY_AWAKE property event. The property eventing must follow the definition of Device Abstraction Layer, Function Property Events.
The device can periodically wake up for commands. The interval can be managed with PROPERTY_WAKE_UP_INTERVAL property.
Table 142.9 WakeUp Properties
Name | Description |
---|---|
awake |
Specifies the awake eventable property name. If the device is awake, it will trigger a property event. The property value type is BooleanData. |
wakeUpInterval |
Specifies the wake up interval. The device can periodically wake up and receive commands. That interval is managed by this property. The property access is readable, writable and eventable. The property value type is LevelData. |
FunctionData subclasses are wrappers on top of the java types to cover the requirements of the Device Abstraction Layer section. They can be received with the getter methods, can be set with the setter methods and can be reported with FunctionEvent. The value can be described with different properties like:
-
timestamp - the timestamp is the difference between the value collecting time and midnight, January 1, 1970 UTC. It's measured in milliseconds. The device driver is responsible to generate that value when the value is received from the device.
-
unit - represents the value unit as it's defined in Function Properties.
-
description - represents a human readable description of the value.
BooleanData is used by BooleanControl, BooleanSensor and WakeUp.
It provides information about the function state. That data object
contains boolean value, the value collecting time and additional
metadata. The value
field is accessible with getValue() getter. Other fields are inherited from the
parent class FunctionData.
Two BooleanData
instances are equal if they contain
equal metadata, timestamp and boolean value.
compareTo(Object) method compares BooleanData
instance with the given argument of the same type and returns:
-
-1
if the instance field is less than a field of the specified argument. -
0
if all fields are equivalent. -
1
if the instance field is greater than a field of the specified argument.
The fields are compared in this order: timestamp, metadata, value.
LevelData is used by MultiLevelControl, MultiLevelSensor, Meter and WakeUp.
It provides information about the function level. That data object
contains BigDecimal
value and the value unit. The
measurement unit is used as it's defined in Function Properties. The unit
field
is accessible with getUnit() getter. The level
field is
accessible with getLevel() getter.
Two LevelData
instances are equal if they contain
equal metadata, timestamp, unit and level.
compareTo(Object) method compares LevelData
instance
with the given argument of the same type and returns:
-
-1
if the instance field is less than a field of the specified argument. -
0
if all fields are equivalent. -
1
if the instance field is greater than a field of the specified argument.
The fields are compared in this order: timestamp, metadata, level, unit.
AlarmData
data structure is used to provide
information about the available alarm. That data object contains:
-
alarm type - indicates the meaning of the alarm like smoke, power fail, etc.
-
alarm severity - indicates the alarm importance level like minor, critical, etc.
The severity
field is accessible with
getSeverity() getter. The type
field is
accessible with getType() getter.
Two AlarmData
instances are equal if they contain
equal metadata, timestamp, type and severity.
compareTo(Object) method compares AlarmData
instance
with the given argument of the same type and returns:
-
-1
if the instance field is less than a field of the specified argument. -
0
if all fields are equivalent. -
1
if the instance field is greater than a field of the specified argument.
The fields are compared in this order: timestamp, metadata, type, severity.
KeypadData is used by Keypad.
KeypadData
data structure is used to provide
information when a change with some key from the keypad has occurred.
That data object contains the event type, sub-type, key code and key
name. Currently, there are two predefined event types:
-
TYPE_PRESSED – used for a key pressed;
-
TYPE_RELEASED – used for a key released.
Predefined event sub-types are:
-
SUB_TYPE_PRESSED_NORMAL – used for a normal key pressed event. Usually, there is a single press and the key is not held down. This sub-type is used with TYPE_PRESSED type.
-
SUB_TYPE_PRESSED_LONG – used for a long key pressed event. Usually, there is a single press and the key is held down. This sub-type is used with TYPE_PRESSED type.
-
SUB_TYPE_PRESSED_DOUBLE – used for a double key pressed event. Usually, there are two press actions and the key is not held down after the second press. This sub-type is used with TYPE_PRESSED type.
-
SUB_TYPE_PRESSED_DOUBLE_LONG – used for a double long key pressed event. Usually, there are two press actions and the key is held down after the second press. This sub-type is used with TYPE_PRESSED type.
The type
field is accessible with getType() getter. The subType
field is
accessible with getSubType() getter. The keyCode
field is
accessible with getKeyCode() getter. The keyName
field is
accessible with getKeyName() getter.
Two KeypadData
instances are equal if they contain
equal metadata, timestamp, event type, sub-type, key code and key
name.
compareTo(Object) method compares KeypadData
instance
with the given argument of the same type and returns:
-
-1
if the instance field is less than a field of the specified argument. -
0
if all fields are equivalent. -
1
if the instance field is greater than a field of the specified argument.
The fields are compared in this order: timestamp, metadata, type, sub-type, key code, key name.
Device Abstraction Layer Functions Package 1.0.
Bundles wishing to use this package must list the package in the Import-Package header of the bundle's manifest. This package has two types of users: the consumers that use the API in this package and the providers that implement the API in this package.
Example import for consumers using the API in this package:
Import-Package: org.osgi.service.dal.functions; version="[1.0,2.0)"
Example import for providers implementing the API in this package:
Import-Package: org.osgi.service.dal.functions; version="[1.0,1.1)"
-
Alarm
-Alarm
function provides alarm sensor support. -
BooleanControl
-BooleanControl
function provides a boolean control support. -
BooleanSensor
-BooleanSensor
function provides boolean sensor monitoring. -
Keypad
-Keypad
function provides support for keypad control. -
Meter
-Meter
function can measure metering information. -
MultiLevelControl
-MultiLevelControl
function provides multi-level control support. -
MultiLevelSensor
-MultiLevelSensor
function provides multi-level sensor monitoring. -
Types
- Shares common constants for all functions defined in this package. -
WakeUp
-WakeUp
function provides device awake monitoring.
Alarm
function provides alarm sensor support. There is only one
eventable property and no operations.
Specifies the alarm property name. The property is eventable.
BooleanControl
function provides a boolean control support. The
eventable function state is accessible with getData() getter and
setData(boolean) setter. The state can be reversed with
inverse() method, can be set to true
value with
setTrue() method and can be set to false
value with
setFalse() method.
The control type can be:
-
other type defined in Types
-
custom - vendor specific type
Specifies the inverse operation name. The operation can be executed with inverse() method.
Specifies the operation name, which sets the control state to
false
value. The operation can be executed with
setFalse() method.
Specifies the operation name, which sets the control state to
true
value. The operation can be executed with setTrue()
method.
Specifies the state property name. The eventable property value is accessible with getData() method.
Returns the current state of BooleanControl
. It's a getter method
for PROPERTY_DATA property.
The current state of BooleanControl
.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
Reverses the BooleanControl
state. If the current state
represents true
value, it'll be changed to false
. If the
current state represents false
value, it'll be changed to
true
. The operation name is OPERATION_INVERSE.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
The new function value.
Sets the BooleanControl
state to the specified value. It's setter
method for PROPERTY_DATA property.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
IllegalArgumentException
– If there is an invalid argument.
Sets the BooleanControl
state to false
value. The
operation name is OPERATION_SET_FALSE.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
Sets the BooleanControl
state to true
value. The
operation name is OPERATION_SET_TRUE.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
BooleanSensor
function provides boolean sensor monitoring. It reports
its state when an important event is available. The eventable state is
accessible with getData() getter. There are no operations.
The sensor type can be:
-
other type defined in Types
-
custom - vendor specific type
Specifies the state property name. The eventable property value is accessible with getData() getter.
Returns the BooleanSensor
current state. It's a getter method for
PROPERTY_DATA property.
The BooleanSensor
current state.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
Keypad
function provides support for keypad control. The keypad
typically consists of one or more keys/buttons, which can be discerned.
Different types of key presses like short and long press can typically also
be detected. Each key pressed event is followed by a key released event. It's
not possible to have two consecutive key pressed or key released events.
There is only one eventable property and no operations.
Keypad
can enumerate all supported keys in the key property metadata,
PropertyMetadata.getEnumValues(String).
Specifies a property name for a key from the keypad. The property is eventable.
Meter
function can measure metering information. The function
provides these properties:
-
PROPERTY_CURRENT - eventable property accessible with getCurrent() getter;
-
PROPERTY_TOTAL - eventable property accessible with getTotal() getter.
The sensor type can be:
-
other type defined in Types
-
custom - vendor specific type
Represents the metering consumption flow. It can be used as SERVICE_FLOW property value.
Represents the metering production flow. It can be used as SERVICE_FLOW property value.
Specifies the current consumption or production property name. The eventable property can be read with getCurrent() getter.
Specifies the total consumption or production property name. The eventable property can be read with getTotal() getter.
The service property value contains the metering flow. It's an optional
property and available only if it's supported by the meter. The value
type is java.lang.String
. Possible property values:
Returns the current metering info. It's a getter method for PROPERTY_CURRENT property.
The current metering info.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
Returns the total metering info. It's a getter method for PROPERTY_TOTAL property.
The total metering info.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
MultiLevelControl
function provides multi-level control support. The
eventable function level is accessible with getData() getter and
setData(BigDecimal, String) setter.
The control type can be:
-
other type defined in Types
-
custom - vendor specific type
Specifies the level property name. The eventable property can be read with getData() getter and can be set with setData(BigDecimal, String) setters.
Returns MultiLevelControl
level. It's a getter method for
PROPERTY_DATA property.
MultiLevelControl
level.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
The new control level.
The level unit.
Sets MultiLevelControl
level according to the specified unit.
It's a setter method for PROPERTY_DATA property.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
IllegalArgumentException
– If there is an invalid argument.
MultiLevelSensor
function provides multi-level sensor monitoring. It
reports its state when an important event is available. The eventable state
is accessible with getData() getter. There are no operations.
The sensor type can be:
-
other type defined in Types
-
custom - vendor specific type
Specifies the state property name. The eventable property can be read with getData() getter.
Returns the MultiLevelSensor
current state. It's a getter method
for PROPERTY_DATA property.
The MultiLevelSensor
current state.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
Shares common constants for all functions defined in this package. The defined function types are mapped as follow:
-
LIGHT - MultiLevelControl, MultiLevelSensor, BooleanSensor and BooleanControl
-
GAS - MultiLevelControl, MultiLevelSensor, BooleanSensor and Meter
-
SMOKE - MultiLevelControl, MultiLevelSensor and BooleanSensor
-
DOOR - MultiLevelControl, MultiLevelSensor, BooleanSensor and BooleanControl
-
WINDOW - MultiLevelControl, MultiLevelSensor, BooleanSensor and BooleanControl
-
POWER - MultiLevelControl, MultiLevelSensor, BooleanSensor, BooleanControl and Meter
-
WATER - BooleanSensor and Meter
The mapping is not mandatory. The function can use custom defined types.
The function type is applicable to:
-
Meter
- indicates that theMeter
measures thermal energy provided by a source.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
BooleanSensor
- indicates that theBooleanSensor
can detect contact.true
state means that there is contact.false
state means that there is no contact.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control the door position.MultiLevelControl
minimum value can completely close the door.MultiLevelControl
maximum value can open the door to the maximum allowed position. -
MultiLevelSensor
- indicates that the sensor can monitor the door position. -
BooleanSensor
- indicates that theBooleanSensor
can detect the door state.true
state means that the door is opened.false
state means that the door is closed. -
BooleanControl
- indicates that there is a door position control.true
state means that the door will be opened.false
state means that the door will be closed.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
BooleanSensor
- indicates that theBooleanSensor
can detect fire.true
state means that there is fire.false
state means that there is no fire.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control the flow level.MultiLevelControl
minimum value is the minimum supported flow level.MultiLevelControl
maximum value is the maximum supported flow level. -
MultiLevelSensor
- indicates that the sensor can monitor the flow level.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control the gas level.MultiLevelControl
minimum value is the lowest supported gas level.MultiLevelControl
maximum value is the highest supported gas level. -
MultiLevelSensor
- indicates that the sensor can monitor the gas level. -
BooleanSensor
- indicates that theBooleanSensor
supports gas detection.true
state means there is gas.false
state means that there is no gas. -
Meter
- indicates that theMeter
measures the gas consumption.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
Meter
- indicates that theMeter
measures thermal energy provided by a source.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control the humidity level. It's typical functionality for HVAC (heating, ventilation, and air conditioning) devices.MultiLevelControl
minimum value is the lowest supported humidity level.MultiLevelControl
maximum value is the highest supported humidity level. -
MultiLevelSensor
- indicates that the sensor can monitor the humidity level.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control light devices. Usually, such devices are called dimmable.MultiLevelControl
minimum value can switch off the device andMultiLevelControl
maximum value can increase the device light to the maximum possible value. -
MultiLevelSensor
- indicates that the sensor can monitor the light level. -
BooleanSensor
- indicates that theBooleanSensor
can detected light.true
state means that there is light.false
state means that there is no light. -
BooleanControl
- indicates that there is a light device control.true
state means that the light device will be turned on.false
state means that the light device will be turned off.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control the liquid level.MultiLevelControl
minimum value is the lowest supported liquid level.MultiLevelControl
maximum value is the highest supported liquid level. -
MultiLevelSensor
- indicates that the sensor can monitor the liquid level.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
BooleanSensor
- indicates that theBooleanSensor
can detect motion.true
state means that there is motion detection.false
state means that there is no motion detection.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control the noise level.MultiLevelControl
minimum value is the lowest supported noise level.MultiLevelControl
maximum value is the highest supported noise level. -
MultiLevelSensor
- indicates that the sensor can monitor the noise level.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
BooleanSensor
- indicates that theBooleanSensor
can detect presence.true
state means that someone is detected.false
state means that nobody is detected.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control the power level.MultiLevelControl
minimum value is the lowest supported power level.MultiLevelControl
maximum value is the highest supported power level. -
MultiLevelSensor
- indicates that the sensor can monitor the power level. -
BooleanSensor
- indicates that theBooleanSensor
can detect power/no power.true
state means that there is power.false
state means that there is no power. -
BooleanControl
- indicates that there is electricity control.true
state means that the power will be restored.false
state means that the power will be cut. -
Meter
- indicates that theMeter
measures the power consumption.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control the pressure level.MultiLevelControl
minimum value is the lowest supported pressure level.MultiLevelControl
maximum value is the highest supported pressure level. -
MultiLevelSensor
- indicates that the sensor can monitor the pressure level. -
Meter
- Indicates that theMeter
measures pressure.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelSensor
- indicates that theMultiLevelSensor
can monitor the rain rate. It's not applicable toMultiLevelControl
. -
BooleanSensor
- indicates that theBooleanSensor
can detect rain.true
state means that there is rain.false
state means that there is no rain.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control the smoke level.MultiLevelControl
minimum value is the lowest supported smoke level.MultiLevelControl
maximum value is the highest supported smoke level. -
MultiLevelSensor
- indicates that the sensor can monitor the smoke level. -
BooleanSensor
- indicates that theBooleanSensor
can detect smoke.true
state means that there is smoke.false
state means that there is no smoke.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control temperature devices. For example, such device can be thermostat.MultiLevelControl
minimum value is the lowest supported temperature.MultiLevelControl
maximum value is the highest supported temperature. -
MultiLevelSensor
- indicates that the sensor can monitor the temperature.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
BooleanSensor
- indicates that theBooleanSensor
can detect water leak.true
state means that there is water leak.false
state means that there is no water leak. -
Meter
- indicates that theMeter
measures water consumption.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
The function type is applicable to:
-
MultiLevelControl
- indicates that theMultiLevelControl
can control the window position.MultiLevelControl
minimum value can completely close the window.MultiLevelControl
maximum value can open the window to the maximum allowed position. -
MultiLevelSensor
- indicates that the sensor can monitor the window position. -
BooleanSensor
- indicates that theBooleanSensor
can window state.true
state means that the window is opened.false
state means that the window is closed. -
BooleanControl
- indicates that there is a window position control.true
state means that the window will be opened.false
state means that the window will be closed.
This type can be specified as a value of org.osgi.service.dal.Function.SERVICE_TYPE.
WakeUp
function provides device awake monitoring. It's especially
applicable to battery-operated devices. Such device can notify the system
that it's awake and can receive commands with a PROPERTY_AWAKE
property event.
The device can periodically wake up for commands. The interval can be managed with PROPERTY_WAKE_UP_INTERVAL property.
Specifies the awake property name. The property access type can be PropertyMetadata.ACCESS_EVENTABLE. If the device is awake, it will trigger a property event.
The property value type is BooleanData
. The boolean data is
always true
. It marks that the device is awake.
Specifies the wake up interval. The device can periodically wake up and receive commands. That interval is managed by this eventable property. The current property value is available with getWakeUpInterval() and can be modified with setWakeUpInterval(BigDecimal, String).
Returns the current wake up interval. It's a getter method for PROPERTY_WAKE_UP_INTERVAL property. The device can periodically wake up and receive command based on this interval.
The interval can be measured in different units like hours, minutes,
seconds, etc. The unit is specified in LevelData
instance.
The current wake up interval.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
The new wake up interval.
The interval unit. If the unit is null
, the interval
is measured in milliseconds.
Sets wake up interval according to the specified unit. It's a setter
method for PROPERTY_WAKE_UP_INTERVAL property. The device can
periodically wake up and receive command based on this interval. The unit
can be null
, then the interval is measured in milliseconds.
IllegalStateException
– If this function service object has already
been unregistered.
DeviceException
– If an operation error is available.
IllegalArgumentException
– If there is an invalid argument.
Device Abstraction Layer Functions Data Package 1.0.
Bundles wishing to use this package must list the package in the Import-Package header of the bundle's manifest. This package has two types of users: the consumers that use the API in this package and the providers that implement the API in this package.
Example import for consumers using the API in this package:
Import-Package: org.osgi.service.dal.functions.data; version="[1.0,2.0)"
Example import for providers implementing the API in this package:
Import-Package: org.osgi.service.dal.functions.data; version="[1.0,1.1)"
-
AlarmData
- Function alarm data. -
BooleanData
- Function boolean data wrapper. -
KeypadData
- Represents a keypad event data that is collected when a change with some key from the keypad has occurred. -
LevelData
- Function level data wrapper.
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.
Represents the severity field name. The field value is available with
getSeverity(). The field type is int
. The constant can
be used as a key to AlarmData(Map) .
Represents the type field name. The field value is available with
getType(). The field type is int
. The constant can be
used as a key to AlarmData(Map).
The severity rating indicates that there a critical alarm. The severity priority is higher than SEVERITY_MINOR and SEVERITY_MAJOR.
The severity rating indicates that there is a major alarm. The severity priority is higher than SEVERITY_MINOR and lower than SEVERITY_CRITICAL.
The severity rating indicates that there is a minor alarm. The severity priority is lower than SEVERITY_MAJOR and SEVERITY_CRITICAL.
The severity constant indicates that there is no severity rating for this alarm.
The alarm type indicates that there is access control issue. For example, the alarm can indicate that the door is unlocked.
The alarm type indicates that there is a burglar notification. For example, the alarm can indicate that the glass is broken.
The alarm type indicates that temperature is too low.
The alarm type indicates that carbon monoxide (CO) is detected.
The alarm type indicates that carbon dioxide (CO2) is detected.
The alarm type indicates that there is hardware failure.
The alarm type indicates that temperature is too high.
The alarm type indicates that there is software failure.
The alarm type indicates that the type is not specified.
The alarm type indicates that a water leak is detected.
Contains the new AlarmData
instance field values.
Constructs new AlarmData
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 the
FIELD_SEVERITY field with 1. If severity is missing,
SEVERITY_UNDEFINED is used.
-
FIELD_SEVERITY - optional field. The value type must be
Integer
. -
FIELD_TYPE - optional field. The value type must be
Integer
.
ClassCastException
– If the field value types are not expected.
IllegalArgumentException
– If the alarm severity is invalid.
NullPointerException
– If the fields map is null
.
The alarm data timestamp optional field.
The alarm data metadata optional field.
The alarm data severity optional field.
The alarm data type optional field.
Constructs new AlarmData
instance with the specified arguments.
IllegalArgumentException
– If the alarm severity is invalid.
AlarmData
to be compared.
Compares this AlarmData
instance with the given argument. If the
argument is not AlarmData
, it throws ClassCastException
.
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.
The fields are compared in this order: timestamp, metadata, type, severity.
-1
, 0
or 1
depending on the comparison
rules.
ClassCastException
– If the method argument is not of type
AlarmData
.
java.lang.Comparable.compareTo(java.lang.Object)
The object to compare this data.
Two AlarmData
instances are equal if they contain equal metadata,
timestamp, type and severity.
true
if this object is equivalent to the specified one.
Returns the alarm severity. The severity can be one of:
The alarm severity.
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.
The alarm type.
Returns the hash code for this AlarmData
object. The hash code is
a sum of FunctionData.hashCode(), the alarm severity and the
alarm type.
The hash code of this AlarmData
object.
Function boolean data wrapper. It can contain a boolean value, timestamp and additional metadata. It doesn't support measurement unit.
BooleanControl, BooleanSensor, FunctionData
Represents the value field name. The field value is available with
getValue(). The field type is boolean
. The constant can
be used as a key to BooleanData(Map).
Contains the new BooleanData
instance field values.
Constructs new BooleanData
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: {"value"=Boolean(true)...}. That map will initialize the
FIELD_VALUE field with true
.
FIELD_VALUE - mandatory field. The value type must be
Boolean
.
ClassCastException
– If the field value types are not expected.
IllegalArgumentException
– If the value is missing.
NullPointerException
– If the fields map is null
.
The boolean data timestamp optional field.
The boolean data metadata optional field.
The boolean value mandatory field.
Constructs new BooleanData
instance with the specified arguments.
BooleanData
to be compared.
Compares this BooleanData
instance with the given argument. If
the argument is not BooleanData
, it throws
ClassCastException
. 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.
The fields are compared in this order: timestamp, metadata, value.
-1
, 0
or 1
depending on the comparison
rules.
ClassCastException
– If the method argument is not of type
BooleanData
.
java.lang.Comparable.compareTo(java.lang.Object)
The object to compare this data.
Two BooleanData
instances are equal if they contain equal
metadata, timestamp and boolean value.
true
if this object is equivalent to the specified one.
Returns the hash code for this BooleanData
object. The hash code
is a sum of FunctionData.hashCode() and
Boolean.hashCode(), where Boolean.hashCode() represents
the boolean value hash code.
The hash code of this BooleanData
object.
Represents a keypad event data that is collected when a change with some key from the keypad has occurred.
The key pressed event is using TYPE_PRESSED type, while the key released event is using TYPE_RELEASED type.
Represents the key code field name. The field value is available with
getKeyCode(). The field type is int
. The constant can
be used as a key to KeypadData(Map).
Represents the key name field name. The field value is available with
getKeyName(). The field type is String
. The constant can
be used as a key to KeypadData(Map).
Represents the event sub-type field name. The field value is available
with getSubType(). The field type is int
. The constant
can be used as a key to KeypadData(Map).
Represents the event type field name. The field value is available with
getType(). The field type is int
. The constant can be
used as a key to KeypadData(Map).
Represents a keypad event sub-type for a double key pressed event. Usually, there are two press actions and the key is not held down after the second press. This sub-type is used with TYPE_PRESSED type.
Represents a keypad event sub-type for a double long key pressed event. Usually, there are two press actions and the key is held down after the second press. This sub-type is used with TYPE_PRESSED type.
Represents a keypad event sub-type for a long key pressed event. Usually, there is a single press and the key is held down. This sub-type is used with TYPE_PRESSED type.
Represents a keypad event sub-type for a normal key pressed event. Usually, there is a single press and the key is not held down. This sub-type is used with TYPE_PRESSED type.
Represents a keypad event type for a key pressed event.
Represents a keypad event type for a key released event.
Contains the new KeypadData
instance field values.
Constructs new KeypadData
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: {"type"=Integer(1)...}. That map will initialize the
FIELD_TYPE field with 1.
-
FIELD_TYPE - mandatory field. The value type must be
Integer
. -
FIELD_SUB_TYPE - optional field. The value type must be
Integer
. -
FIELD_KEY_CODE - mandatory field. The value type must be
Integer
. -
FIELD_KEY_NAME - optional field. The value type must be
String
.
ClassCastException
– If the field value types are not expected.
IllegalArgumentException
– If the event type or key code is missing
or invalid arguments are specified.
NullPointerException
– If the fields map is null
.
The data timestamp optional field.
The data metadata optional field.
The data event type mandatory field.
The data event sub-type optional field or 0
if
there is no sub-type.
The data key code mandatory field.
The data key name optional field or null
if there
is no key name.
Constructs new KeypadData
instance with the specified arguments.
KeypadData
to be compared.
Compares this KeypadData
instance with the given argument. If the
argument is not KeypadData
, it throws ClassCastException
.
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.
The fields are compared in this order: timestamp, metadata, type, sub-type, key code, key name.
-1
, 0
or 1
depending on the comparison
rules.
ClassCastException
– If the method argument is not of type
KeypadData
.
java.lang.Comparable.compareTo(java.lang.Object)
The object to compare this data.
Two KeypadData
instances are equal if they contain equal
metadata, timestamp, event type, key code and key name.
true
if this object is equivalent to the specified one.
The code of the key. This field is mandatory and it holds the semantics(meaning) of the key.
The key code.
Represents a human readable name of the corresponding key code. This
field is optional and sometimes it could be missed(might be null
).
A string with the name of the key or null
if not
specified.
Returns the event sub-type. The sub-type provides additional details about the event. The sub-type can be one of:
Zero and positive values are reserved for this definition and further extensions of the sub-types. Custom sub-types can be used only as negative values to prevent potential collisions.
The event sub-type.
Returns the event type. The type represents the main reason for this event. It can be one of:
The event type.
Returns the hash code for this KeypadData
object. The hash code
is a sum of FunctionData.hashCode(), String.hashCode(),
event type, event sub-type and key code, where String.hashCode()
represents the key name hash code if available.
The hash code of this LevelData
object.
Function level data wrapper. It supports all properties defined in
FunctionData
.
MultiLevelControl, MultiLevelSensor, Meter, FunctionData
Represents the level field name. The field value is available with
getLevel(). The field type is BigDecimal
. The constant
can be used as a key to LevelData(Map).
Represents the unit field name. The field value is available with
getUnit(). The field type is String
. The constant can be
used as a key to LevelData(Map).
Contains the new LevelData
instance field values.
Constructs new LevelData
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: {"level"=BigDecimal(1)...}. That map will initialize the
FIELD_LEVEL field with 1.
-
FIELD_LEVEL - mandatory field. The value type must be
BigDecimal
. -
FIELD_UNIT - optional field. The value type must be
String
.
ClassCastException
– If the field value types are not expected.
IllegalArgumentException
– If the level is missing.
NullPointerException
– If the fields map is null
.
The data timestamp optional field.
The data metadata optional field.
The level value mandatory field.
The data unit optional field.
Constructs new LevelData
instance with the specified arguments.
NullPointerException
– If level
is null
.
LevelData
to be compared.
Compares this LevelData
instance with the given argument. If the
argument is not LevelData
, it throws ClassCastException
.
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.
The fields are compared in this order: timestamp, metadata, level, unit.
-1
, 0
or 1
depending on the comparison
rules.
ClassCastException
– If the method argument is not of type
LevelData
.
java.lang.Comparable.compareTo(java.lang.Object)
The object to compare this data.
Two LevelData
instances are equal if they contain equal metadata,
timestamp, unit and level.
true
if this object is equivalent to the specified one.
Returns LevelData
value. The value type is BigDecimal
instead of double
to guarantee value accuracy.
The LevelData
value.
Returns LevelData
unit as it's specified in
PropertyMetadata.UNITS or null
if the unit is missing.
The value unit or null
if the unit is missing.
Returns the hash code for this LevelData
object. The hash code is
a sum of FunctionData.hashCode(), String.hashCode() and
BigDecimal.hashCode(), where String.hashCode() represents
the unit hash code and BigDecimal.hashCode() represents the level
hash code.
The hash code of this LevelData
object.