Closed danihbelan closed 6 years ago
Hi,
please check the manual chapter 9.
In order to use handles with read/write requests the "useHandles" property of the client must be set to true or set the "handle" parameter of the request to true.
The handles are stored internally in the "Plc" object, you can log it with "Plc.logHandleCache()".
Does the client start without problems? Are there any error messages?
Next thing is the context. Are you sure that your "output" variable has a global context? TAME needs this. NPM modules are capsuled normally. I work on an Ionic app and have to get the window object in a closure to work with TAME.
After log HandleCache I get an empty object: {}
And when I do: Plc.writeBool({'.VAR1', val: true}) (that work and change my PLC variable) I get this message:
{ addr: undefined, symbolName: '.VAR1', dataTypeNames: [], dataTypeArrIdx: undefined, symbolNameArrIdx: undefined, fullSymbolName: '.VAR1', useHandle: undefined, id: undefined, oc: undefined, ocd: undefined, oe: undefined, ot: undefined, readLength: 1, debug: undefined, sync: undefined, offs: undefined, seq: true, items: [ { val: true, jvar: undefined, type: 'BOOL', prefix: undefined, suffix: undefined } ] }
Thats not really helpful. TAME logs a lot of messages. There must be some when you get the handles. Have you checked them?
I have already managed to fix it. Thanks you!
Hi @tomcx ,
I have an app in Node.js where I used your library. I trying to do write and read request. The problem is that to use the read function "handles" is necessary. I tried to get it previously with "getHandles()" function but it does not work.
I'm a little lost on the subject of "handles".
You can see my code here: https://github.com/danihbelan/WebSoftPLC/blob/development/privates/softPLC/PLC.js
And thanks for your fantastic library!