Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Connecting With Transparent Mode Before Dlms Read

Connecting with transparent mode before Dlms read

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By hhkx , 21 September, 2020
Forums
Gurux.DLMS

Hi,

I have a modem that needs to be start with transparent mode to connect by sending a special command then continue Dlms reading.

Is there an option in Gurux to set a command after settings.Media.Open(); before reader.InitializeConnection(); ?

Should below code do the job? And what is "receiver" in this case?

settings.Media.Open();
settings.media.Send("command-to-switch", receiver);
reader.InitializeConnection();

hhkx

5 years 8 months ago

Any opinion?

Any opinion?

Profile picture for user Kurumi

Kurumi

5 years 8 months ago

Hi,

Hi,

You can do it like this:
settings.Media.Open();
lock (settings.Media)
{
Gurux.Common.ReceiveParameters<byte[]> p = new Gurux.Common.ReceiveParameters<byte[]>()
{
WaitTime = 1000, //Wait time in ms.
Count = 2, //Min byte count expected to receive.
Eop = "\r\n" //End of the packet.
};
settings.media.Send("command-to-switch", null);
if (!settings.media.Receive(p))
{
throw new Error("Failed to receive reply");
}

BR,
Mikko

hhkx

5 years 8 months ago

Hi Mikko,

Hi Mikko,

settings.media.Receive(p) always returns false.

Is there any option that I can see Rx and Tx packages? Is TraceLevel.Verbose enough? I mean does Receive(p) method writes any log in communication?

I am sending the same package with Packet Sender and it returns the "ok" message. However, when I try above code, it throws the exception (that we write "Failed to receive reply")

btw: I am setting the eop as "ok"

Profile picture for user Kurumi

Kurumi

5 years 8 months ago

Hi,

Hi,

I believe that your device is sending something else than ok. If you are sending just ok and no data, change Count to 0.
You can get trace setting trace level to verbose and listen verbose events. Like this
settings.media.Trace = TraceLevel.Verbose;
settings.media.OnTrace += new TraceEventHandler(mediaOnTrace);

void mediaOnTrace(object sender, TraceEventArgs e)
{

}

BR,
Mikko

hhkx

5 years 8 months ago

Hi Mikko,

Hi Mikko,

Thank you for your support

hhkx

5 years 8 months ago

Hi,

Hi,

Are Count and Eop not for received data? Why should I set them according to sending data?

With packet sender;

Sending:

ABC5|8|N|1

Receiving:

ABC:ok

With gurux:

var p = new Gurux.Common.ReceiveParameters<byte[]>() {
WaitTime = 15000, //Wait time in ms.
Count = 2, //Min byte count expected to receive.
Eop = "ok" //End of the packet.
};

settings.Media.Send("ABC5|8|N|1", null);

and it throws the exception.

Profile picture for user Kurumi

Kurumi

5 years 8 months ago

Hi,

Hi,

Try with this:
Eop = ASCIIEncoding.ASCII.GetBytes("ok");

BR,

Mikko

hhkx

5 years 8 months ago

ok that makes sense, thank

ok that makes sense, thank you!

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin