Dear Mikko,
I do not know if it is correct to report in this modality 'issues' relevant to example code. Nevertheless, with the sake of contributing, let me please share with you that I experienced an issue when using the '-S' command line option for the Client example (GuruxDLMSClientExample).
The '-S' option, as far as I have understood, is meant to allow the selection of serial port communication parameters, including the baudrate, with this syntax:
-S [COM1:9600:8None1]
However, the baurate isn't actually affected by the specified command line parameter (e.g.: -S [COM1:38400:8None1]) will default to 9600 baud.
I used this command line (so you can check if I made any mistake preventing to proper use of ‘-S’ command line option):
./bin/gurux.dlms.client.bin -c 16 -s 1 -S "/dev/ttyS0:57600:8None1" -r ln -i HDLC -T "4775727578313233" -A D0A1A2A3A4A5A6A7A8A9AAABACADAEAF -B 300102030405060708090A0B0C0D0E0F -V "Suite0" -f 2000 -w 1 -P "Claudio" -a "None" -C "None"
To this extent, I made these small modifications in file [communication.cpp]:
- in line 443 change:
unsigned short baudRate;
to
unsigned int baudRate;
- in line 611 change
cfsetospeed(&options, B9600);
cfsetispeed(&options, B9600);
to
speed_t baudRate_speed=getTermiosSpeed(baudRate,1);
cfsetospeed(&options, baudRate_speed);
cfsetispeed(&options, baudRate_speed);
- adding a the getTermiosSpeed() function as per this code:
https://github.com/stephane/libmodbus/blob/b25629bfb508bdce7d519884c0fa….
Thank you
Best regards,
Claudio
Hi Claudio, Thank you for…
Hi Claudio,
Thank you for pointing this out. This is now fixed and a new client example is in GitHub.
BR,
Mikko