-
-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add the ability to generate 1.03 compatible address-space and export them to NodeSet2.xml ( 1.03 requires the old way to define DataType structure) - restore the ability to load old NodeSet2.xml even if nodes are set as Deprecated in the NodeSet2.xml file.
- Loading branch information
1 parent
510df2e
commit 53c85a4
Showing
21 changed files
with
2,045 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/node-opcua-client-dynamic-extension-object/.mocharc.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require: | ||
- ../../node_modules/source-map-support/register | ||
- ../../node_modules/ts-node/register | ||
- ../../node_modules/should | ||
extension: | ||
- ts | ||
- js | ||
recursive: true | ||
timeout: 20000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...t-dynamic-extension-object/source/convert_structuretype_schema_to_structure_definition.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { CommonInterface, FieldCategory, FieldEnumeration, FieldType, IStructuredTypeSchema } from "node-opcua-factory"; | ||
import { StructureDefinition, StructureType, StructureDefinitionOptions, StructureFieldOptions } from "node-opcua-types"; | ||
import { NodeId, resolveNodeId } from "node-opcua-nodeid"; | ||
import { DataType } from "node-opcua-variant"; | ||
|
||
function _getDataType(field: FieldType): NodeId { | ||
switch (field.category) { | ||
case FieldCategory.complex: | ||
return resolveNodeId((field.schema as any).dataTypeNodeId); | ||
case FieldCategory.basic: | ||
return resolveNodeId(field.fieldType); | ||
case FieldCategory.enumeration: | ||
default: | ||
return resolveNodeId(field.dataType!); | ||
} | ||
} | ||
|
||
export function convertStructureTypeSchemaToStructureDefinition(st: IStructuredTypeSchema): StructureDefinition { | ||
|
||
let structureType = StructureType.Invalid; | ||
let isUnion = false; | ||
if (st.baseType === "Union") { | ||
structureType = StructureType.Union; | ||
isUnion = true; | ||
} else { | ||
structureType = StructureType.Structure; | ||
} | ||
// convert partial field (not including base class) | ||
const structureDefinition: StructureDefinitionOptions = { | ||
fields: [], | ||
baseDataType: st.getBaseSchema()?.dataTypeNodeId, | ||
defaultEncodingId: st.encodingDefaultBinary, | ||
structureType | ||
}; | ||
const fields: StructureFieldOptions[] = structureDefinition.fields || []; | ||
for (const f of st.fields) { | ||
const dataType = _getDataType(f); | ||
if (isUnion && f.originalName === "SwitchField") { | ||
continue; | ||
} | ||
fields.push({ | ||
arrayDimensions: f.isArray ? [] : undefined, | ||
valueRank: f.isArray ? 1 : -1, | ||
dataType, | ||
isOptional: isUnion ? undefined: f.switchValue !== undefined, | ||
description: f.documentation || undefined, | ||
name: f.originalName | ||
}); | ||
} | ||
return new StructureDefinition(structureDefinition); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.