# Gurux - commands for start example ## java example #### Server ```bash # on windows java -jar .\gurux.dlms.server.example.java\target\gurux.dlms.server.example.java-0.0.1-SNAPSHOT.jar # on linux java -jar gurux.dlms.server.example.java/target/gurux.dlms.server.example.java-0.0.1-SNAPSHOT.jar ``` --- ##### server help ```bash Gurux DLMS example Server implements four DLMS/COSEM devices. -t [Error, Warning, Info, Verbose] Trace messages. -p Start port number. Default is 4060. -S \t serial port. -r [sn, sn]\t Short name or Logican Name (default) referencing is used. -K \t Private key File. Ex. -k C:\\priv.pem -k \t Public key File. Ex. -k C:\\pub.pem ``` --- #### client - basic ```bash # on windows java -jar .\gurux.dlms.client.example.java\target\gurux.dlms.client.example.java-0.0.1-SNAPSHOT.jar -h localhost -p 4061 # on linux java -jar gurux.dlms.client.example.java/target/gurux.dlms.client.example.java-0.0.1-SNAPSHOT.jar -h localhost -p 4061 ``` - with authentication ```bash # on windows java -jar .\gurux.dlms.client.example.java\target\gurux.dlms.client.example.java-0.0.1-SNAPSHOT.jar -h 140.120.15.159 -p 4061 -a High -P Gurux # on linux java -jar gurux.dlms.client.example.java/target/gurux.dlms.client.example.java-0.0.1-SNAPSHOT.jar -h localhost -p 4061 -a High -P Gurux ``` --- ##### client help ```bash GuruxDlmsSample reads data from the DLMS/COSEM device. GuruxDlmsSample -h [Meter IP Address] -p [Meter Port No] -c 16 -s 1 -r sn -h host name or IP address. -p port number or name (Example: 1000). -S serial port. -a Authentication (None, Low, High, HighMd5, HighSha1, HighGMac, HighSha256). -P Password for authentication. -c Client address. (Default: 16) -s Server address. (Default: 1) -n Server address as serial number. -l Logical Server address. -r [sn, ln] Short name or Logical Name (default) referencing is used. -t [Error, Warning, Info, Verbose] Trace messages. -g "0.0.1.0.0.255:1; 0.0.1.0.0.255:2" Get selected object(s) with given attribute index. -C Security Level. (None, Authentication, Encrypted, AuthenticationEncryption) -v Invocation counter data object Logical Name. Ex. 0.0.43.1.1.255 -I Auto increase invoke ID -o Cache association view to make reading faster. Ex. -o C:\device.xml -T System title that is used with chiphering. Ex -D 4775727578313233 -A Authentication key that is used with chiphering. Ex -D D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF -B Block cipher key that is used with chiphering. Ex -D 000102030405060708090A0B0C0D0E0F -D Dedicated key that is used with chiphering. Ex -D 00112233445566778899AABBCCDDEEFF -d Used DLMS standard. Ex -d India (DLMS, India, Italy, SaudiArabia, IDIS) -K Meter's private key File. Ex. -k C:\priv.pem -k Client's public key File. Ex. -k C:\pub.pem -i Used communication interface. Ex. -i WRAPPER. -m Used PLC MAC address. Ex. -m 1. Example: Read LG device using TCP/IP connection. GuruxDlmsSample -r sn -c 16 -s 1 -h [Meter IP Address] -p [Meter Port No] Read LG device using serial port connection. GuruxDlmsSample -r sn -c 16 -s 1 -S COM1 -i Read Indian device using serial port connection. GuruxDlmsSample -S COM1 -c 16 -s 1 -a Low -P [password] ``` ----- ## C example ----- ## C++ example ----- ## C# example ----- ----- ----- ## Java ServerLN&SN code ### Short Name or Logical Name Server - GXDLMSServerSN - GXDLMSServerLN ```java= public class GXDLMSServerLN extends GXDLMSBase { public GXDLMSServerLN() { super(new GXDLMSAssociationLogicalName(), new GXDLMSHdlcSetup()); } } ``` ```java= public GXDLMSBase(final GXDLMSAssociationLogicalName ln, final GXDLMSHdlcSetup hdlc) { super(ln, hdlc); setPushClientAddress(64); this.setMaxReceivePDUSize(1024); byte[] secret = "Gurux".getBytes(); ln.setSecret(secret); // Add security setup object. ln.setSecuritySetupReference("0.0.43.0.0.255"); GXDLMSSecuritySetup s = new GXDLMSSecuritySetup(); s.setServerSystemTitle(getCiphering().getSystemTitle()); getItems().add(s); } ``` - GXDLMSServerSN_47 - GXDLMSServerLN_47 ###### tags: `work`