
icube DLMS python demo package
------------------------------

Installation of icube python packages
-------------------------------------
The python implementation of i-cube's DLMS/COSEM components for the demo
is provided without the code source (with some exceptions).

The distribution is made of .pyc and .pyd files and dedicated to win32-2.7
(i.e. win32 platform and Python 2.7).

This prevent us to create a normal Distutils setup.py scripts.

We suggest that you copy the 'icube' directory from 'dist/pyIcubeDlms-2.1.zip'
in your installation 'Lib/site-packages' or whereever it suits you.
Warning, don't copy it to 'src' folder, because pyDev may remove the *.pyc without
warning when the corresponding *.py files are missing.

Of course we ship the source files to our customers who buy a license.

Eclipse pyDev project
---------------------
This demo package was made with Eclipse-Indigo and pyDev plugin.
 
It allows you to access a DLMS compliant meter using the Hdlc communication
profile connected and a serial port.

The Hdlc parameters must be defined in EzTest._initialize_parameters(..).
'iec' flag in __main__ must be defined True if you use an optical probe.

Usage:
ez [file.xml ]*

This command works as follow:
- connects to the server
- process all xml files specified [if any]
	- convert from xml to pdu
	- send pdu to the meter and gets it's response
	- convert pdu response to xml
- disconnect.

i.e.
python test.py ez		# connect/disconnect
python test.py ez ./misc/AssociationRequest_SN_NoPW.xml
python test.py ez ./misc/AssociationRequest_SN_NoPW.xml ./misc/ReadRequest(ObjectsList).xml

We use pyserial to access the serial port. Use pypm or any other mean to install it.

Miscelleanous
-------------
There is currently no help file for the python implementation of DLMS/COSEM.
As all implementations use the same architecture, you can download the C# help file at:
http://icube.ch/demo_projects/csharp/dlms_csharp_demo_help.zip

The 'pySignature' folder contains "signatures" of some modules which provide the
signature of classes and methods used by the test.py script.
Other relevant *.py modules can be found in the distribution zip.

The 'misc' folder contains a few .xml files. Other file are available at:
http://icube.ch/zip/xmlexamples.zip

 Output sample
 -------------
 Generated with a meter accessed by optical probe.
 
 ['C:\\tmp\\000-dlms\\pyDlms\\pyDlms\\src\\test.py', 'ez', './misc/AssociationRequest_SN_NoPW.xml']
--> /?!<CR><LF>
<-- /LGZ4\2ZMD4104407.B24<CR><LF>
--> <ACK>242<CR><LF>
--- baud changeover --- 4800

CB_S: 7EA0070321930F017E
CB_R: 7EA01E210373C37A81801205018006013E07040000000108040000000107227E
CB_s: Normal Response Mode.
-----     -----     -----     -----     -----     -----     
process_file: ./misc/AssociationRequest_SN_NoPW.xml
<AssociationRequest>
  <ApplicationContextName Value="SN" />
  <InitiateRequest>
    <ProposedDlmsVersionNumber Value="06" />
    <ProposedConformance>
      <ConformanceBit Name="ParametrizedAccess" />
      <ConformanceBit Name="MultipleReferences" />
      <ConformanceBit Name="Write" />
      <ConformanceBit Name="Read" />
    </ProposedConformance>
    <ProposedMaxPduSize Value="FFFF" />
  </InitiateRequest>
</AssociationRequest>
CB_S: 7EA02B032110FBAFE6E600601DA109060760857405080102BE10040E01000000065F1F0400180220FFFF2B9A7E
CB_R: 7EA0372103306C7CE6E7006128A109060760857405080102A203020100A305A103020100BE0F040D0800065F1F04001802200960FA000AA87E
<AssociationResponse>
  <ApplicationContextName Value="SN" />
  <AssociationResult Value="00" />
  <ResultSourceDiagnostic>
    <ACSEServiceUser Value="00" />
  </ResultSourceDiagnostic>
  <InitiateResponse>
    <NegotiatedDlmsVersionNumber Value="06" />
    <NegotiatedConformance>
      <ConformanceBit Name="ParametrizedAccess" />
      <ConformanceBit Name="MultipleReferences" />
      <ConformanceBit Name="Write" />
      <ConformanceBit Name="Read" />
    </NegotiatedConformance>
    <NegotiatedMaxPduSize Value="0960" />
    <VaaName Value="FA00" />
  </InitiateResponse>
</AssociationResponse>

CB_S: 7EA00703215303C77E
CB_R: 7EA01E210373C37A81801205018006013E07040000000108040000000107227E
CB_s: Normal Disconnected Mode.
 