st-one-io / node-opc-da

A Node library for OPC-DA communication.
Apache License 2.0
29 stars 13 forks source link

Error: unknown.queryInterface is not a function when getGroupByName() in opcServer.js #4

Open ericambiel opened 4 years ago

ericambiel commented 4 years ago

When I try to use the function "getGroupByName (name)" it returns an error. After a superficial debug I found that "resultObj.getResults ()" returns two _type and _obj objects, the initialization must be done in _obj.

let result = resultObj.getResults(); if (hresult != 0) { if (result.lenght == 0) throw new Error(String(hresult)); else debug(new Error(String(hresult))); }

    let group = new OPCGroupStateManager();
    await group.init(result[0]._obj); // <= here line 257 of "opcServer.js"
    debug("Successfully get request for group \"" + name +"\".");
    return group;
}

After that, the error will no longer occur and degug.log returns us: Successfully get request for group "XYZ_Test".