I am trying to write values (from my gateway module) in tags using the following write method of SQLTagsManager interface:
java.util.List write(java.util.List<WriteRequest> writes, AuthenticatedUser user, boolean isSystem)
Writes to the tags/properties defined by the tag paths.
But i am at a loss how initialize the AuthenticatedUser user implementing class? Can someone please guide me with an exapmle.
If youâre calling this from a gateway module without being invoked in a context where you might have an AuthenticatedUser object (an RPC call from the client for example) then you can use a null value for user and the isSystem flag to true.
Hi Kevin,
Thanks for the reply. The execution goes through now but I donât get the right results!
Is my initialization of writepaths correct in the following code?
when i print the two value it gives âAccess Denied ACCESS_DENIEDâ for name and description respectively. I am trying to write to one of the tags of the simpleTagProvider example given in your SDK extended to 20 tags from 10 tags given in the example.
PRAMANJ
The SimpleTagProvider example already has the following code:
ourProvider.registerWriteHandler(CONTROL_TAG, new WriteHandler() { @Override
public Quality write(TagPath target, Object value) {
Integer intVal = TypeUtilities.toInteger(value);
//The adjustTags function will add/remove tags, AND update the current value of the control tag.
adjustTags(intVal);
return CommonQualities.GOOD;
}
});
But I am not using this write method! I am just using the following call as explained in my earlier reply.
If youâre writing to a TagPath that you havenât registered a WriteHandler for in the SimpleTagProvider then youâll get the Access Denied qualityâŚ
try writing to whatever the TagPath for that CONTROL_TAG that has a registered handler is and see if it works.
That means only the registered tag provider can update value of any of its own tags not some someone else? What if I want to update one of the SimpleTageProviderâs tags given in the examples in SDK from my gatewayHook Module using the write method of SQLTagsManager interface. I thought the isSystem flag set to true will override access qualifier for tags for a gateway module! Is there any way I can write a value on any tag in the system from my gateway module? How does ignition client write to a PLC input tag from an input button on client, to switch ON/OFF an equipment?
regards
PRAMANJ
The TagProvider a tag belongs to is ultimately responsible for allowing the tag to be written or not.
With the SimpleTagProvider the very first thing required for allowing writes is having a WriteHandler for that tag. If you control the SimpleTagProvider AND you want to write to a tag, then youâll need a WriteHandler.
If youâre writing to tags belonging to another tag provider youâre at the mercy of the provider to allow you to write. While the SimpleTagProvider requires WriteHandlers be registered for any tag to write, other tag providers are all free to work in their own way.
In your test code if you were writing an OPC or memory tag belonging to the internal provider instead of a SimpleTagProvider that you arenât registering WriteHandlers on your write would likely go through, assuming you had the correct TagPath and permissions (or use system flag + null user).
Hi Kevin,
That makes sense! Bottom line is it should be tag driven by Internal tag provider and memory tag or even OPC tag. (bit surprised about OPC tag is also writable! Perhaps it may also have some access protection in the address space it belongs to).
I think reading any valid tag path doesnât have any such restriction about internal or external tag provider or memory or database tag etc. Please correct me if I am wrong.