I am using .Net Gurux Client Example and trying to read Profile Generic (1.0.99.1.0.255) over TCP/IP
Wrapper mode but It results error as Error! Failed to read first row Access denied Read write where as with same configuration over DLMS Director it works.
Can You please tell me what else I have to do in case of .Net Client Example ?
They are both using the same source code. Can you post profile generic read and reply trace here? Post only those 2 lines. I'll check what might be the problem.
Below is the code and attached is the log file for reference
public void GetProfileGenerics()
{
//Find profile generics register objects and read them.
foreach (GXDLMSObject it in Client.Objects.GetObjects(ObjectType.ProfileGeneric))
{
//If trace is info.
if (Trace > TraceLevel.Warning)
{
Console.WriteLine("-------- Reading " + it.GetType().Name + " " + it.Name + " " + it.Description);
}
long entriesInUse = Convert.ToInt64(Read(it, 7));
long entries = Convert.ToInt64(Read(it, 8));
//If trace is info.
if (Trace > TraceLevel.Warning)
{
Console.WriteLine("Entries: " + entriesInUse + "/" + entries);
}
//If there are no columns or rows.
if (entriesInUse == 0 || (it as GXDLMSProfileGeneric).CaptureObjects.Count == 0)
{
continue;
}
//All meters are not supporting parameterized read.
if ((Client.NegotiatedConformance & (Gurux.DLMS.Enums.Conformance.ParameterizedAccess | Gurux.DLMS.Enums.Conformance.SelectiveAccess | Gurux.DLMS.Enums.Conformance.Read)) != 0)
{
Read(it, 2);
try
{
//Read first row from Profile Generic.
object[] rows = ReadRowsByEntry(it as GXDLMSProfileGeneric, 1, 1);
//If trace is info.
if (Trace > TraceLevel.Warning)
{
StringBuilder sb = new StringBuilder();
foreach (object[] row in rows)
{
foreach (object cell in row)
{
if (cell is byte[])
{
sb.Append(GXCommon.ToHex((byte[])cell, true));
}
else
{
sb.Append(Convert.ToString(cell));
}
sb.Append(" | ");
}
sb.Append("\r\n");
}
Console.WriteLine(sb.ToString());
}
}
catch (Exception ex)
{
Console.WriteLine("Error! Failed to read first row: " + ex.Message);
//Continue reading.
}
}
//All meters are not supporting parameterized read.
if ((Client.NegotiatedConformance & (Gurux.DLMS.Enums.Conformance.ParameterizedAccess | Gurux.DLMS.Enums.Conformance.SelectiveAccess)) != 0)
{
try
{
//Read last day from Profile Generic.
object[] rows = ReadRowsByRange(it as GXDLMSProfileGeneric, DateTime.Now.Date, DateTime.MaxValue);
//If trace is info.
if (Trace > TraceLevel.Warning)
{
StringBuilder sb = new StringBuilder();
foreach (object[] row in rows)
{
foreach (object cell in row)
{
if (cell is byte[])
{
sb.Append(GXCommon.ToHex((byte[])cell, true));
}
else
{
sb.Append(Convert.ToString(cell));
}
sb.Append(" | ");
}
sb.Append("\r\n");
}
Console.WriteLine(sb.ToString());
}
}
catch (Exception ex)
{
Console.WriteLine("Error! Failed to read last day: " + ex.Message);
//Continue reading.
}
}
Using ReadRowsByRange I am getting error as Access Error : Device reports Read-Write denied
object[] arr_temp = ReadRowsByRange(it as GXDLMSProfileGeneric, Convert.ToDateTime("2019-10-11"), Convert.ToDateTime("2019-10-12"));
Hi,
Hi,
Change authentication level to the same as in GXDLMSDirector.
BR,
Mikko
Hello,
Hello,
In my case authentication level in both DLMS Director and Client Example .Net is same.
'Low with Password'
Hi,
Hi,
They are both using the same source code. Can you post profile generic read and reply trace here? Post only those 2 lines. I'll check what might be the problem.
BR,
Mikko
Below is the code and
Below is the code and attached is the log file for reference
public void GetProfileGenerics()
{
//Find profile generics register objects and read them.
foreach (GXDLMSObject it in Client.Objects.GetObjects(ObjectType.ProfileGeneric))
{
//If trace is info.
if (Trace > TraceLevel.Warning)
{
Console.WriteLine("-------- Reading " + it.GetType().Name + " " + it.Name + " " + it.Description);
}
long entriesInUse = Convert.ToInt64(Read(it, 7));
long entries = Convert.ToInt64(Read(it, 8));
//If trace is info.
if (Trace > TraceLevel.Warning)
{
Console.WriteLine("Entries: " + entriesInUse + "/" + entries);
}
//If there are no columns or rows.
if (entriesInUse == 0 || (it as GXDLMSProfileGeneric).CaptureObjects.Count == 0)
{
continue;
}
//All meters are not supporting parameterized read.
if ((Client.NegotiatedConformance & (Gurux.DLMS.Enums.Conformance.ParameterizedAccess | Gurux.DLMS.Enums.Conformance.SelectiveAccess | Gurux.DLMS.Enums.Conformance.Read)) != 0)
{
Read(it, 2);
try
{
//Read first row from Profile Generic.
object[] rows = ReadRowsByEntry(it as GXDLMSProfileGeneric, 1, 1);
//If trace is info.
if (Trace > TraceLevel.Warning)
{
StringBuilder sb = new StringBuilder();
foreach (object[] row in rows)
{
foreach (object cell in row)
{
if (cell is byte[])
{
sb.Append(GXCommon.ToHex((byte[])cell, true));
}
else
{
sb.Append(Convert.ToString(cell));
}
sb.Append(" | ");
}
sb.Append("\r\n");
}
Console.WriteLine(sb.ToString());
}
}
catch (Exception ex)
{
Console.WriteLine("Error! Failed to read first row: " + ex.Message);
//Continue reading.
}
}
//All meters are not supporting parameterized read.
if ((Client.NegotiatedConformance & (Gurux.DLMS.Enums.Conformance.ParameterizedAccess | Gurux.DLMS.Enums.Conformance.SelectiveAccess)) != 0)
{
try
{
//Read last day from Profile Generic.
object[] rows = ReadRowsByRange(it as GXDLMSProfileGeneric, DateTime.Now.Date, DateTime.MaxValue);
//If trace is info.
if (Trace > TraceLevel.Warning)
{
StringBuilder sb = new StringBuilder();
foreach (object[] row in rows)
{
foreach (object cell in row)
{
if (cell is byte[])
{
sb.Append(GXCommon.ToHex((byte[])cell, true));
}
else
{
sb.Append(Convert.ToString(cell));
}
sb.Append(" | ");
}
sb.Append("\r\n");
}
Console.WriteLine(sb.ToString());
}
}
catch (Exception ex)
{
Console.WriteLine("Error! Failed to read last day: " + ex.Message);
//Continue reading.
}
}
}
}
Hello,
Hello,
I am getting values in this as I enable breakpoint
Read(it, 2)
How can I iterate for loop on Read(it, 2) to get all the values ?
Hi,
Hi,
Please, don't post client example or full log. I'll ask admin to remove it.
BR,
Mikko
Hello,
Hello,
Using Below code I am able to read and get the values
var obj = Read(it, 2);
object[] arr = obj as object[];
How can I get buffer based on timestamp as start time and end time ?
Hi,
Hi,
You can use ReadRowsByRange method.
BR,
Mikko
Using ReadRowsByRange I am
Using ReadRowsByRange I am getting error as Access Error : Device reports Read-Write denied
object[] arr_temp = ReadRowsByRange(it as GXDLMSProfileGeneric, Convert.ToDateTime("2019-10-11"), Convert.ToDateTime("2019-10-12"));
Hi,
Hi,
Make sure that there is data between that date. Some meters are returning an error if there is no data available between the given range.
BR,
Mikko