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


TypeScript node-opcua-factory.registerEnumeration函数代码示例

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


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

示例1: registerEnumeration

/**
 * @module node-opcua-data-model
 */
import { registerEnumeration } from "node-opcua-factory";

export enum NodeClass {
    Unspecified=       0,  // No classes are selected.
    Object=            1,  // The node is an object.
    Variable=          2,  // The node is a variable.
    Method=            4,  // The node is a method.
    ObjectType=        8,  // The node is an object type.
    VariableType=     16,  // The node is an variable type.
    ReferenceType=    32,  // The node is a reference type.
    DataType=         64,  // The node is a data type.
    View=            128   // The node is a view.
}
export const schemaEnumNodeClass = {
    name: "NodeClass",

    documentation: "A mask specifying the class of the node.",
    enumValues: NodeClass
};
registerEnumeration(schemaEnumNodeClass);
开发者ID:node-opcua,项目名称:node-opcua,代码行数:23,代码来源:nodeclass.ts

示例2: encodeTimestampsToReturn

import { Enum } from "node-opcua-enum";
import { registerEnumeration } from "node-opcua-factory";

export enum TimestampsToReturn {
    Source = 0,
    Server = 1,
    Both = 2,
    Neither = 3,
    Invalid = 4
}

export const schemaTimestampsToReturn = {
    name: "TimestampsToReturn",

    enumValues: TimestampsToReturn
};

export function encodeTimestampsToReturn(value: TimestampsToReturn, stream: OutputBinaryStream) {
    stream.writeUInt32(value);
}

function clamp(min: number, a: number, max: number) {
    return Math.max(Math.min(a, max), min);
}

export function decodeTimestampsToReturn(stream: BinaryStream): TimestampsToReturn {
    return clamp(TimestampsToReturn.Source, stream.readUInt32(), TimestampsToReturn.Invalid) as TimestampsToReturn;
}

export const _enumerationTimestampsToReturn: Enum = registerEnumeration(schemaTimestampsToReturn);
开发者ID:node-opcua,项目名称:node-opcua,代码行数:30,代码来源:TimestampsToReturn_enum.ts

示例3: registerEnumeration

/**
 * @module node-opcua-data-value
 */
import { Enum } from "node-opcua-enum";
import { registerEnumeration } from "node-opcua-factory";

export enum DataValueEncodingByte {
Value=              0x01,
StatusCode=         0x02,
SourceTimestamp=    0x04,
ServerTimestamp=    0x08,
SourcePicoseconds=  0x10,
ServerPicoseconds=  0x20
}
export const schemaDataValueEncodingByte = {
    name: "DataValue_EncodingByte",

    enumValues: DataValueEncodingByte
};
export const _enumerationDataValueEncodingByte: Enum = registerEnumeration(schemaDataValueEncodingByte);
开发者ID:node-opcua,项目名称:node-opcua,代码行数:20,代码来源:DataValueEncodingByte_enum.ts

示例4: registerEnumeration

/**
 * @module node-opcua-variant
 */
import { Enum } from "node-opcua-enum";
import { registerEnumeration } from "node-opcua-factory";

export enum VariantArrayType {
    Scalar= 0x00,
    Array=  0x01,
    Matrix=  0x02
}

const schemaVariantArrayType = {
    enumValues: VariantArrayType,
    name: "VariantArrayType",
};

/***
 * @private
 */
export const _enumerationVariantArrayType: Enum = registerEnumeration(schemaVariantArrayType);
开发者ID:node-opcua,项目名称:node-opcua,代码行数:21,代码来源:VariantArrayType_enum.ts

示例5: registerEnumeration

// returned. The fields are assigned the following bits:
import { Enum } from "node-opcua-enum";
import { registerEnumeration } from "node-opcua-factory";

export enum ResultMask {
    ReferenceType=  0x01,
    IsForward=      0x02,
    NodeClass=      0x04,
    BrowseName=     0x08,
    DisplayName=    0x10,
    TypeDefinition= 0x20
}
export const schemaResultMask = {
    name: "ResultMask",

    enumValues: ResultMask
};
export const _enumerationResultMask: Enum = registerEnumeration(schemaResultMask);

// The ReferenceDescription type is defined in 7.24.
// @example
//      makeNodeClassMask("Method | Object").should.eql(5);
export function makeResultMask(str: string): ResultMask {
    const flags = str.split(" | ");
    let r = 0;
    for (const flag of flags) {
        r |= (ResultMask as any)[flag];
    }
    return r as ResultMask;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:30,代码来源:result_mask.ts

示例6: registerEnumeration

/* tslint:disable:variable-name */
import { registerEnumeration, StructuredTypeOptions } from "node-opcua-factory";

export enum Color {
    RED=   100,
    BLUE=  200,
    GREEN= 300,
}
const schema_EnumColor = registerEnumeration({
    enumValues: Color,
    name: "EnumColor",
});

export const schema_Shape: StructuredTypeOptions = {
    baseType: "",
    name: "Shape",
    fields: [
        {
            defaultValue: () => "my shape",
            fieldType: "String",
            name: "name",
        },
        {
            fieldType: "EnumShapeType",
            name: "shapeType",
        },
        {
            defaultValue: Color.GREEN,
            fieldType: "EnumColor",
            name: "color",
        },
开发者ID:node-opcua,项目名称:node-opcua,代码行数:31,代码来源:Shape_schema.ts

示例7: registerEnumeration

    Byte =             3, // unsigned Byte = UInt8
    Int16=             4,
    UInt16=            5,
    Int32=             6,
    UInt32=            7,
    Int64=             8,
    UInt64=            9,
    Float=            10,
    Double=           11,
    String=           12,
    DateTime=         13,
    Guid=             14,
    ByteString=       15,
    XmlElement=       16,
    NodeId=           17,
    ExpandedNodeId=   18,
    StatusCode=       19,
    QualifiedName=    20,
    LocalizedText=    21,
    ExtensionObject=  22,
    DataValue=        23,
    Variant=          24,
    DiagnosticInfo=   25
}
const schemaDataType = {
    name: "DataType",

    enumValues: DataType
};
export const _enumerationDataType: Enum = registerEnumeration(schemaDataType);
开发者ID:node-opcua,项目名称:node-opcua,代码行数:30,代码来源:DataType_enum.ts

示例8: encodeBrowseDirection

    Forward=  0, // return forward references.
    Inverse=  1, // return inverse references.
    Both=     2,  // return forward and inverse references.
    Invalid=  3, //
}

export const schemaBrowseDirection = {
    name: "BrowseDirection",

    enumValues: BrowseDirection,
    // decode: (stream: BinaryStream) => {
    //
    //     const value = stream.readInteger();
    //     if (value < 0 || value > 2) {
    //         return BrowseDirection.Invalid;
    //     }
    //     return BrowseDirection[value];
    // }
};

export function encodeBrowseDirection(value: BrowseDirection, stream: OutputBinaryStream) {
    stream.writeUInt32(value);
}

export function decodeBrowseDirection(stream: BinaryStream): BrowseDirection {

    return stream.readUInt32() as BrowseDirection;
}

export const _enumerationBrowseDirection: Enum = registerEnumeration(schemaBrowseDirection);
开发者ID:node-opcua,项目名称:node-opcua,代码行数:30,代码来源:BrowseDirection.ts


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