Class LogicalDevice


  • public class LogicalDevice
    extends java.lang.Object
    This class represents a logical device in the physical server/meter.
    • Constructor Detail

      • LogicalDevice

        public LogicalDevice​(int logicalDeviceId,
                             java.lang.String logicalDeviceName,
                             java.lang.String manufacturerId,
                             long deviceId)
        Creates a new Logical Device.
        Parameters:
        logicalDeviceId - logical device id. Id to identify the logical device. Integer greater than 0.
        logicalDeviceName - The logical device name is defined as an octet-string of up to 16 octets/characters. The first three octets/characters shall carry the manufacturer identifier. The manufacturer shall ensure that the logical device name, starting with the three octets/characters identifying the manufacturer and followed by up to 13 octets/characters, is unique.
        manufacturerId - unique String ID of three characters. See: DLMS UA FLAG Manufacturers ID
        deviceId - 5 byte device ID.
        Throws:
        java.lang.IllegalArgumentException - if a parameter does not fulfill its requirements.
    • Method Detail

      • getLogicalDeviceName

        public java.lang.String getLogicalDeviceName()
      • getManufacturerId

        public java.lang.String getManufacturerId()
      • getLogicalDeviceId

        public int getLogicalDeviceId()
      • getMasterKey

        public byte[] getMasterKey()
      • setMasterKey

        public LogicalDevice setMasterKey​(byte[] masterKey)
        Sets the master key.

        NOTE: The master key must be 128 bits (16 byte) long.

        Parameters:
        masterKey - the master key.
        Returns:
        the logical device.
        Throws:
        java.lang.IllegalArgumentException - if the key length is not supported.
      • addRestriction

        public boolean addRestriction​(int clientId,
                                      SecuritySuite securitySuite)
        Adds a restriction to the Logical Device. If there's no restriction set up, the server allows connections from all client IDs.

        NOTE: The master key must be set if a key is used in the authentication.

        Parameters:
        clientId - the client ID. Value greater than zero.
        securitySuite - a new restriction/security suite for the logical device.
        Returns:
        true if the clientId was not set so far, false otherwise.
        Throws:
        java.lang.IllegalArgumentException - if the arguments don't fulfill their requirements.
        See Also:
        setMasterKey(byte[])
      • registerCosemObject

        public LogicalDevice registerCosemObject​(CosemInterfaceObject... cosemObject)
        Register a new COSEM class. It's not allowed to register classes with identical instance IDs (OBIS code). The class must be annotated with CosemClass.
        Parameters:
        cosemObject - a class annotated with CosemClass.
        Returns:
        the LogicalDevice instance.
        See Also:
        CosemClass
      • registerCosemObject

        public LogicalDevice registerCosemObject​(java.util.List<CosemInterfaceObject> cosemObject)
        Register a new COSEM class. It's not allowed to register classes with identical instance IDs (OBIS code). The class must be annotated with CosemClass.
        Parameters:
        cosemObject - a class annotated with CosemClass.
        Returns:
        the LogicalDevice instance.
      • getRestrictions

        public java.util.Map<java.lang.Integer,​SecuritySuite> getRestrictions()
      • getSystemTitle

        public byte[] getSystemTitle()
      • setConformance

        public LogicalDevice setConformance​(ConformanceSetting... conformanceSetting)
        Sets the logical device conformance. No conformance setting is set, the logical device accepts all service requests.
        Parameters:
        conformanceSetting - set the conformance settings.
        Returns:
        the LogicalDevice instance.