We have trying to use the meter simulator in place of real meter. We generated the template from CLOU single phase meter. We're able to connect to the meter using HIGH_GMAC with AES_GCM_128. We have so far been able to update the clock.
Now want to test the disconnect control but we're getting read-write denied error. This is the simulator logic that triggers this error:
The disconnect control returns an error. The reason is that disconnect action is not implemented for the GXDLMSDisconnect object. There is nothing that the object can do and you need to handle this in PreAction.
Thanks for the response.
Do you mean we need to add the disconnection action in the PreAction method like the other examples shown?
Also we have to do the same thing for other objects, correct?
Do you please have any reference explaining on how to set the values of these elements in the template?
if (it.Target is GXDLMSDisconnect && it.Index == 1)
{
Console.WriteLine("Disconnect called");
it.Handled = true;
}
The server will return ACK for the disconnect action.
Access rights are set when a new object is added to the association view and those values can't be changed after that. What do you want to do with them?
Do you mean add that logic to PreRead? PreAction is not being triggered for the disconnection control.
Regarding access rights, we want the set the correct access rights (read/write etc) for each object in the template. But we don't know what are the access rights for given object.
We're able to workaround this issue by updating the association method access for the disconnect control in onGetMethodAccess in the server.
But we think the method access rights should be set in the template file. No?
Also we had to set outputState in the onPreAction. Otherwise it's not being updated.
Access rights are read from the connected association. If you check the association view, you can see that there the logical name and associations are under it. The reason for this is that there might be multiple associations and with some associations, you can read and with other read and write object attributes.
Hi,
Hi,
The disconnect control returns an error. The reason is that disconnect action is not implemented for the GXDLMSDisconnect object. There is nothing that the object can do and you need to handle this in PreAction.
https://github.com/Gurux/Gurux.DLMS.Net/blob/2d542fd95146b10829a6ad9b78…
BR,
Mikko
Hi Mikko,
Hi Mikko,
Thanks for the response.
Do you mean we need to add the disconnection action in the PreAction method like the other examples shown?
Also we have to do the same thing for other objects, correct?
Do you please have any reference explaining on how to set the values of these elements in the template?
<Access>3300</Access>
<MethodAccess>11</MethodAccess>
Thanks,
Imand
Hi Imand,
Hi Imand,
Add this for the preaction.
if (it.Target is GXDLMSDisconnect && it.Index == 1)
{
Console.WriteLine("Disconnect called");
it.Handled = true;
}
The server will return ACK for the disconnect action.
Access rights are set when a new object is added to the association view and those values can't be changed after that. What do you want to do with them?
BR,
Mikko
Hi Mikko,
Hi Mikko,
Do you mean add that logic to PreRead? PreAction is not being triggered for the disconnection control.
Regarding access rights, we want the set the correct access rights (read/write etc) for each object in the template. But we don't know what are the access rights for given object.
Thanks, again.
Imand
Hi,
Hi,
If you are calling the disconnect or reconnect is't using invoke and not read. Try this with GXDLMSDirector.
Access right values are:
Read = 1
Write = 2
ReadWrite = 3
There is one number for each attribute that describes the access rights.
BR,
Mikko
Hi Mikko,
Hi Mikko,
I think the read-write error is caused by method access rights not being correct. Here is the code in ServerBase that triggers the error:
public final int notifyGetMethodAccess(final ValueEventArgs arg) throws Exception {
if (owner instanceof GXDLMSServer) {
GXAttributeCollection attributes = arg.getTarget().getMethodAttributes();
GXDLMSAttributeSettings att = attributes.find(arg.getIndex());
/// If attribute is not set return read only.
if (att == null) {
return MethodAccessMode.NO_ACCESS.getValue();
}
return att.getMethodAccess().getValue();
} else if (owner instanceof GXDLMSServer3) {
if (getSettings().getAssignedAssociation().getVersion() < 3) {
return ((GXDLMSServer3) owner).onGetMethodAccess(arg).getValue();
} else {
return MethodAccessMode3.toInteger(((GXDLMSServer3) owner).onGetMethodAccess3(arg));
}
}
return ((GXDLMSServer2) owner).onGetMethodAccess(arg).getValue();
}
This "if" is returning the error:
if (getSettings().getAssignedAssociation().getVersion() < 3) {
return ((GXDLMSServer3) owner).onGetMethodAccess(arg).getValue();
}
This is what we have in the template file. We tried different values without success:
<MethodAccess>11</MethodAccess>
Any idea?
Thanks,
Imand
Hi Mikko,
Hi Mikko,
We're able to workaround this issue by updating the association method access for the disconnect control in onGetMethodAccess in the server.
But we think the method access rights should be set in the template file. No?
Also we had to set outputState in the onPreAction. Otherwise it's not being updated.
Thanks,
Imand
Hi Imand,
Hi Imand,
Access rights are read from the connected association. If you check the association view, you can see that there the logical name and associations are under it. The reason for this is that there might be multiple associations and with some associations, you can read and with other read and write object attributes.
BR,
Mikko
Ok. Got it. Thanks, Imand
Ok. Got it.
Thanks,
Imand