libraries_demo project setup in ''eclipse''
Please, follow these steps to setup an eclipse Java project for the libraries_demo project.
The demo project provides demo classes for:
- Confirmed associations using AssociationRequest/Response services (this is the usual variant)
- Consumer Information Interface (using pushed DataNotification services).
Whether you test the libraries for one or the other variant, the eclipse setup is the same.
This setup was done using eclipse Mars.
Unzip dlms_java_demo.zip in a new directory
The demo project is in the libraries_demo sub directory.
The libraries_demo directory structure looks like this:
Select a new suitable workspace.
Import the libraries_demo project
Notice that you cannot import libraries_demo if you already have a project with the same name in the workspace.
Select File/Import/General/Existing Projects into Workspace
Check the Java build path:
Click on libraries_demo Properties/Java Build Path/Libraries and check the following:
If you are only interested in the Consumer Information Interface demo, then skip to CII demo.
Confirmed associations using AssociationRequest
Select de demo example and set the parameters
In the Package explorer, go to 'src/icube.demo', there are 6 demos, 5 confirmed and one CII (push) demos. Among the 5 confirmed demo, 4 are using the HDLC profile and one using the TCP profile with the 'Wrapper''. Select one of the demo and go to the initializeParameters() method. Then, for an HDLC demo, define the HDLC parameters, for example:
- ClientMacAddress = 16 (public client)
- ServerAddressSize = 1 (one byte addressing, can also be 2 or 4)
- ServerUpperMacAddress = 1 (is the address of the ''management logical device'').
- ServerLowerMacAddress = x (is the physical address of the meter, not needed when ServerAddressSize = 1)
For a WRAPPER demo, define the WRAPPER parameters:
- ClientAddress = 16 (public client),
- ServerAddress = 1 (management logical device)
- Host = "127.0.0.1" (IP address of the server)
- Port = 2078 (port that the server listens to)
Create a new "Run configuration" :
Select Run/Run Configurations.../Java Application
Then, run it without arguments; the output should be as follows, which is just a connection and a disconnection of the HDLC layer:
Define the arguments
In the run configuration, select 'Argument' and add either the AssociationRequest_SN_NoPW xml file if your meter supports short names referencing or Associationrequest_LN_NoPW xml file if your meter supports long names referencing. These files contain XML presentations of AssociationRequest services The demo send the encoded content of this file after having connected the HDLC layer, which then establish an application association.
Run it and you should have something like this:
You can list several xml files in the Run Configuration/Arguments/Program arguments, the demo will process all the files in order
Consumer Information Interface
The Consumer Information Interface demo retrieves data pushed to a serial port.
If you have a ''real'' meter, then go to initializeParameters() and define portName as the COM port where the meter pushes its data.
If you don't have a real meter, then go to initializeParameters() and define portName = null. Then, the demo will create a local stream of octets (CIIStream) that simulates the push according to this description.
Create a new "Run configuration" :
Run/Run Configurations.../Java Application
If you run it with the local stream, you should have this: