How to use the node-opcua-utils.lowerFirstLetter function in node-opcua-utils

To help you get started, we’ve selected a few node-opcua-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-address-space / test_helpers / boiler_system.ts View on Github external
context: SessionContext,
                callback: (err: Error | null, callMethodResult: CallMethodResultOptions) => void
            ) {
                const stateMachineW = this.parent! as StateMachine;
                // tslint:disable-next-line:no-console
                console.log("Boiler System :  " + methodName + " about to process");
                stateMachineW.setState(toState);
                callback(null, {
                    outputArguments: [],
                    statusCode: StatusCodes.Good,
                });
            });

        assert(programStateMachine.getMethodByName(methodName) !== null,
            "Method " + methodName + " should be added to parent object (checked with getMethodByName)");
        const lc_name = lowerFirstLetter(methodName);
    }
github node-opcua / node-opcua / packages / node-opcua-address-space / src / base_node.ts View on Github external
public uninstall_extra_properties(reference: Reference) {

        const addressSpace = this.addressSpace;

        if (addressSpace.isFrugal) {
            // skipping
            return;
        }
        const childNode = resolveReferenceNode(addressSpace, reference);

        const name = lowerFirstLetter(childNode.browseName.name!.toString());
        if (reservedNames.hasOwnProperty(name)) {
            if (doDebug) {
                // tslint:disable-next-line:no-console
                console.log(chalk.bgWhite.red("Ignoring reserved keyword                                     " + name));
            }
            return;
        }
        /* istanbul ignore next */
        if (!this.hasOwnProperty(name)) {
            return;
        }

        Object.defineProperty(this, name, {
            value: undefined
        });
    }
github node-opcua / node-opcua / packages / node-opcua-server / src / server_session.js View on Github external
ServerSession.prototype.incrementRequestTotalCounter = function (counterName) {
    const session = this;
    if (session._sessionDiagnostics) {
        const propName = lowerFirstLetter(counterName + "Count");
        if (!session._sessionDiagnostics.hasOwnProperty(propName)) {
            console.log(" cannot find", propName);
            //xx return;
        }
        //   console.log(self._sessionDiagnostics.toString());
        session._sessionDiagnostics[propName].totalCount = session._sessionDiagnostics[propName].totalCount + 1;
    }
};
ServerSession.prototype.incrementRequestErrorCounter = function (counterName) {
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space_add_event_type.js View on Github external
}
                // ignore also methods
                if (node instanceof UAMethod) {
                    //xx console.log(" skipping method ", node.browseName.toString());
                    return;
                }


                _process_var(self,"",node);

                // also store value in index
                //xx eventData.__nodes[node.nodeId.toString()] = eventData[lowerName];

                const children =node.getAggregates();
                if (children.length >0) {
                    const lowerName =lowerFirstLetter(node.browseName.name);
                    //xx console.log(" Children to visit = ",lowerName,children.map(function(a){ return a.browseName.toString();}).join(" "));
                    children.map(function(child) {
                        _process_var(self,lowerName + ".",child);
                    });

                }
            });
        }
github node-opcua / node-opcua / packages / node-opcua-address-space / src / ua_variable.js View on Github external
assert(self.$extensionObject && self.$extensionObject.constructor, "expecting an valid extension object");
        assert(s.statusCode.equals(StatusCodes.Good));

        Constructor = addressSpace.getExtensionObjectConstructor(self.dataType);
        assert(Constructor);
        assert(self.$extensionObject.constructor.name === Constructor.name);
    }


    let property, field, camelCaseName;
    // ------------------------------------------------------
    // now bind each member
    // ------------------------------------------------------
    for (let fieldIndex = 0; fieldIndex < dt.definition.length; fieldIndex++) {
        field = dt.definition[fieldIndex];
        camelCaseName = lowerFirstLetter(field.name);
        const component = components.filter(function (f) {
            return f.browseName.name.toString() === field.name;
        });
        if (component.length === 1) {
            property = component[0];
            /* istanbul ignore next */
        }
        else {
            assert(component.length === 0);
            // create a variable (Note we may use ns=1;s=parentName/0:PropertyName)
            property = self.namespace.addVariable({
                browseName: {namespaceIndex: structureNamespace, name: field.name.toString()},
                dataType: field.dataType,
                componentOf: self,
                minimumSamplingInterval: self.minimumSamplingInterval
            });
github node-opcua / node-opcua / packages / node-opcua-aggregates / source / aggregates.ts View on Github external
function setUInt32(propName: string) {
        const lowerCase = utils.lowerFirstLetter(propName);
        /* istanbul ignore next */
        if (!historyServerCapabilities.hasOwnProperty(lowerCase)) {
            throw new Error("cannot find " + lowerCase);
        }
        const value = defaultProperties[lowerCase];
        const prop = historyServerCapabilities.getChildByName(propName);
        prop.setValueFromSource({ dataType: DataType.UInt32, value });
    }
github node-opcua / node-opcua / packages / node-opcua-aggregates / source / aggregates.ts View on Github external
function setBoolean(propName: string) {
        const lowerCase = utils.lowerFirstLetter(propName);

        /* istanbul ignore next */
        if (!defaultProperties.hasOwnProperty(lowerCase)) {
            throw new Error("cannot find " + lowerCase);
        }
        const value = defaultProperties[lowerCase];
        const prop = historyServerCapabilities.getChildByName(propName);

        /* istanbul ignore next */
        if (!prop) {
            throw new Error(" Cannot find property " + propName);
        }
        prop.setValueFromSource({ dataType: DataType.Boolean, value });

    }
github node-opcua / node-opcua / packages / node-opcua-address-space / test_helpers / boiler_system.js View on Github external
}
        assert(method instanceof UAMethod);
        method._getExecutableFlag = function (context) {
            return MygetExecutableFlag.call(this, toState, methodName);
        };

        method.bindMethod(function (inputArguments, context, callback) {

            const stateMachineW = StateMachine.promote(this.parent);
            //xx console.log("Hello World ! I will " + methodName + " the process");
            stateMachineW.setState(toState);
            callback();
        });
        assert(programStateMachine.getMethodByName(methodName) !== null, "Method " + methodName + " should be added to parent object (checked with getMethodByName)");
        assert(programStateMachine.getComponentByName(methodName) !== null, "Component (Method) " + methodName + " should be added to parent object (checked with getComponentByName)");
        const lc_name = lowerFirstLetter(methodName);
        assert(programStateMachine[lc_name] != null, "Must have a javascript member called : " + lc_name);
        assert(programStateMachine[lc_name].browseName.toString()== methodName);
    }
github node-opcua / node-opcua / packages / node-opcua-client / source / alarms_and_conditions / client_alarm.ts View on Github external
function setProperty(_data: any, fieldName: string, value: Variant) {
        let name: string;
        if (!fieldName || value === null) {
            return;
        }
        const f = fieldName.split(".");
        if (f.length === 1) {
            fieldName = lowerFirstLetter(fieldName);
            _data[fieldName] = value;
        } else {
            for (let i = 0; i < f.length - 1; i++) {
                name = lowerFirstLetter(f[i]);
                _data[name] = _data[name] || {};
                _data = _data[name];
            }
            name = lowerFirstLetter(f[f.length - 1]);
            _data[name] = value;
        }
    }
    if (fields.length > eventFields.length) {