当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript node-opcua-utils.get_clock_tick函数代码示例

本文整理汇总了TypeScript中node-opcua-utils.get_clock_tick函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get_clock_tick函数的具体用法?TypeScript get_clock_tick怎么用?TypeScript get_clock_tick使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_clock_tick函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: _send_chunk

    private _send_chunk(callback: ErrorCallback | undefined, messageChunk: Buffer | null) {

        if (messageChunk) {
            this.transport.write(messageChunk);
        } else {
            if (doPerfMonitoring) {
                // record tick 3 : transaction completed.
                this._tick3 = get_clock_tick();
            }

            if (callback) {
                setImmediate(callback);
            }

            if (doPerfMonitoring) {
                this._record_transaction_statistics();

                /* istanbul ignore next */
                if (doDebug) {
                    // dump some statistics about transaction ( time and sizes )
                    _dump_transaction_statistics(this.last_transaction_stats);
                }
            }
            this.emit("transaction_done");
        }
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:26,代码来源:server_secure_channel_layer.ts

示例2: _on_common_message

    private _on_common_message(request: Request, msgType: string, requestId: number, channelId: number) {

        /* istanbul ignore next */
        if (doTraceMessages) {
            dump_request(request, requestId, channelId);
        }

        if (this.messageBuilder.sequenceHeader === null) {
            throw new Error("Internal Error");
        }

        requestId = this.messageBuilder.sequenceHeader.requestId;

        const message: Message = {
            channel: this,
            request,
            requestId
        };

        if (msgType === "CLO" && request.schema.name === "CloseSecureChannelRequest") {
            this.close();
        } else if (msgType === "OPN" && request.schema.name === "OpenSecureChannelRequest") {
            // intercept client request to renew security Token
            this._handle_OpenSecureChannelRequest(message, (/* err?: Error*/) => {
            });
        } else {
            if (request.schema.name === "CloseSecureChannelRequest") {
                console.log("WARNING : RECEIVED a CloseSecureChannelRequest with MSGTYPE=" + msgType);
                this.close();
            } else {
                if (doPerfMonitoring) {
                    // record tick 1 : after message has been received, before message processing
                    this._tick1 = get_clock_tick();
                }

                if (this.securityToken && channelId !== this.securityToken.channelId) {
                    // response = new ServiceFault({responseHeader: {serviceResult: certificate_status}});
                    debugLog("Invalid channelId detected =", channelId, " <> ", this.securityToken.channelId);
                    return this.send_error_and_abort(
                      StatusCodes.BadCommunicationError,
                      "Invalid Channel Id specified " + this.securityToken.channelId,
                      message, () => {

                      });
                }

                /**
                 * notify the observer that a OPCUA message has been received.
                 * It is up to one observer to call send_response or send_error_and_abort to complete
                 * the transaction.
                 *
                 * @event message
                 * @param message
                 */
                this.emit("message", message);
            }
        }
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:58,代码来源:server_secure_channel_layer.ts

示例3: createDiagnostic

        function createDiagnostic(index: number) {
            const t5 = utils.get_clock_tick();
            const sessionObject = namespace.addObject({
                browseName: "Session" + index,
                organizedBy: addressSpace.rootFolder.objects
            });

            // the extension object
            const t6 = utils.get_clock_tick();
            const _sessionDiagnostics = addressSpace.constructExtensionObject(sessionDiagnosticsDataType);
            const t7 = utils.get_clock_tick();
            const sessionDiagnostics = sessionDiagnosticsVariableType.instantiate({
                browseName: {name: "SessionDiagnostics", namespaceIndex: 0},
                componentOf: sessionObject,
                value: new Variant({ dataType: DataType.ExtensionObject, value: _sessionDiagnostics })
            });
            const t8 = utils.get_clock_tick();
            // xx debugLog(" t8-t7",t8-t7);

            objs.push(sessionObject);
        }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:21,代码来源:test_address_space_construct_extension_object.ts

示例4: get_clock_tick

        this._packetAssembler.on("newMessage", (info, data) => {

            if (doPerfMonitoring) {
                // record tick 0: when the first data is received
                this._tick0 = get_clock_tick();
            }
            /**
             *
             * notify the observers that a new message is being built
             * @event start_chunk
             * @param info
             * @param data
             */
            this.emit("start_chunk", info, data);
        });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:15,代码来源:message_builder_base.ts

示例5: _feed_messageChunk

    private _feed_messageChunk(chunk: Buffer) {
        assert(chunk);
        const messageHeader = readMessageHeader(new BinaryStream(chunk));
        /**
         * notify the observers that new message chunk has been received
         * @event chunk
         * @param messageChunk the raw message chunk
         */
        this.emit("chunk", chunk);

        if (messageHeader.isFinal === "F") {

            // last message
            this._append(chunk);
            if (this._hasReceivedError) {
                return false;
            }

            const fullMessageBody: Buffer = this.blocks.length === 1 ? this.blocks[0] : Buffer.concat(this.blocks);

            if (doPerfMonitoring) {
                // record tick 1: when a complete message has been received ( all chunks assembled)
                this._tick1 = get_clock_tick();
            }
            /**
             * notify the observers that a full message has been received
             * @event full_message_body
             * @param full_message_body the full message body made of all concatenated chunks.
             */
            this.emit("full_message_body", fullMessageBody);

            this._decodeMessageBody(fullMessageBody);

            // be ready for next block
            this._init_new();
            return true;

        } else if (messageHeader.isFinal === "A") {
            return this._report_error("received and Abort Message");

        } else if (messageHeader.isFinal === "C") {
            return this._append(chunk);
        }
        return false;
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:45,代码来源:message_builder_base.ts

示例6: send_response

    /**
     * @method send_response
     * @async
     * @param msgType
     * @param response
     * @param message
     * @param callback
     */
    public send_response(
      msgType: string,
      response: Response,
      message: Message,
      callback?: ErrorCallback
    ): void {

        const request = message.request;
        const requestId = message.requestId;

        if (this.aborted) {
            debugLog("channel has been terminated , cannot send responses");
            return callback && callback(new Error("Aborted"));
        }

        // istanbul ignore next
        if (doDebug) {
            assert(response.schema);
            assert(request.schema);
            assert(requestId > 0);
            // verify that response for a given requestId is only sent once.
            if (!this.__verifId) {
                this.__verifId = {};
            }
            assert(!this.__verifId[requestId], " response for requestId has already been sent !! - Internal Error");
            this.__verifId[requestId] = requestId;
        }

        if (doPerfMonitoring) {
            // record tick : send response received.
            this._tick2 = get_clock_tick();
        }

        assert(this.securityToken);

        let options = {
            channelId: this.securityToken.channelId,
            chunkSize: this.transport.receiveBufferSize,
            requestId,
            tokenId: this.securityToken.tokenId
        };

        const securityOptions =
          msgType === "OPN" ? this._get_security_options_for_OPN() : this._get_security_options_for_MSG();
        options = _.extend(options, securityOptions);

        response.responseHeader.requestHandle = request.requestHeader.requestHandle;

        /* istanbul ignore next */
        if (0 && doDebug) {
            console.log(" options ", options);
            analyze_object_binary_encoding(response as any as BaseUAObject);
        }

        /* istanbul ignore next */
        if (doTraceMessages) {
            console.log(
              chalk.cyan.bold("xxxx   >>>> ---------------------------------------- "),
              chalk.green.bold(response.schema.name),
              requestId
            );
            console.log(response.toString());
            console.log(chalk.cyan.bold("xxxx   >>>> ----------------------------------------|\n"));
        }

        if (this._on_response) {
            this._on_response(msgType, response, message);
        }

        this._transactionsCount += 1;
        this.messageChunker.chunkSecureMessage(
          msgType,
          options as ChunkMessageOptions,
          response as any as BaseUAObject,
          (messageChunk: Buffer | null) => {
              return this._send_chunk(callback, messageChunk);
          });
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:86,代码来源:server_secure_channel_layer.ts

示例7: get_clock_tick

 .on("start_chunk", () => {
     if (doPerfMonitoring) {
         // record tick 0: when the first chunk is received
         this._tick0 = get_clock_tick();
     }
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:6,代码来源:server_secure_channel_layer.ts


注:本文中的node-opcua-utils.get_clock_tick函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。