Package org.openmuc.jdlms
Annotation Type CosemAttribute
-
@Target(FIELD) @Retention(RUNTIME) @Documented public @interface CosemAttribute
This annotation is used to define a COSEM attribute in a COSEM class. Only fields of typeDataObject
can be annotated with this annotation.@
To intercept read or write accesses of the attribute, a public get/set method must be provided. The get method must have get as a prefix and the set method respectively a set as a prefix.CosemClass
(id = 99, version = 2) public class DemoClass extends CosemInterfaceObject { @CosemAttribute
(id = 2) privateDataObject
data; ... }The set and get methods may only throw an
IllegalAttributeAccessException
.@
CosemClass
(id = 99, version = 2) public class DemoClass extends CosemInterfaceObject { @CosemAttribute
(id = 2, type = Type.INTEGER) privateDataObject
data; ... public void setData(DataObject newData) throwsIllegalAttributeAccessException
{ Number value = newData.getValue(); if (value.intValue() < 10) { throw new IllegalAttributeAccessException(AccessResultCode.TYPE_UNMATCHED); } this.data = newData; } }NOTE: Ambiguous attribute ID's in a class are not allowed. Attribute ID 1 is reserved for the system.
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description byte
id
The attribute ID.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description AttributeAccessMode
accessMode
The access restriction for the attribute in a COSEM class.int[]
selector
Attribute sector ID's in a value range 0 to 255.int
snOffset
The offset from the base name.DataObject.Type
type
The data type of the attribute.
-
-
-
-
accessMode
AttributeAccessMode accessMode
The access restriction for the attribute in a COSEM class.NOTE: This attribute is optional.
- Returns:
- the access mode.
- Default:
- org.openmuc.jdlms.AttributeAccessMode.READ_AND_WRITE
-
-
-
type
DataObject.Type type
The data type of the attribute. If a client may want to send a different type, the server will deny the write access.- Returns:
- the type of the attribute.
- Default:
- org.openmuc.jdlms.datatypes.DataObject.Type.DONT_CARE
-
-
-
selector
int[] selector
Attribute sector ID's in a value range 0 to 255.NOTE: get and set methods with
SelectiveAccessDescription
s for the attribute must be provided.- Returns:
- the attribute selector.
- See Also:
SelectiveAccessDescription
- Default:
- {}
-
-