Package org.openmuc.jdlms
Annotation Type CosemMethod
-
@Target(METHOD) @Retention(RUNTIME) @Documented public @interface CosemMethod
This annotation is used to define a COSEM method in a COSEM class.The annotate method must be public. It can have a single parameter of type
DataObject
, it can return aDataObject
and it can throw anIllegalMethodAccessException
.@
CosemClass
(id = 99, version = 2) public class DemoClass extends CosemInterfaceObject { ... @CosemMethod
(id = 1) public void foo() { System.out.println("Hello World"); } @CosemMethod
(id = 2, consumes = Type.OCTET_STRING) public void bar(DataObject param) { byte[] octetStr = param.getValue(); System.out.println("Hello " + new String(octetStr, StandardCharsets.US_ASCII)); } @CosemMethod
(id = 3, consumes = Type.OCTET_STRING) public DataObject fooBar(DataObject param, Long connectionId) { // evaluate connection ID byte[] octetStr = param.getValue(); System.out.println("Hello " + new String(octetStr)); return DataObject.newNullData(); } }NOTE: Ambiguous method ID's in a class are not allowed.
- See Also:
CosemClass
,DataObject
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description byte
id
The method ID.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description MethodAccessMode
accessMode
Restrict the access mode of the method.DataObject.Type
consumes
The type of the parameter if it exists.int
snOffset
The offset from the base name.
-
-
-
-
consumes
DataObject.Type consumes
The type of the parameter if it exists.- Returns:
- the parameter type.
- Default:
- org.openmuc.jdlms.datatypes.DataObject.Type.DONT_CARE
-
-
-
accessMode
MethodAccessMode accessMode
Restrict the access mode of the method.- Returns:
- the access mode of the method.
- Default:
- org.openmuc.jdlms.MethodAccessMode.ACCESS
-
-