Skip to content

referencetype

Canonical path: o6.referencetype

referencetype

referencetype(
    *,
    ns=None,
    nodeId=None,
    browseName=None,
    displayName=None,
    description=None,
    writeMask=None,
    userWriteMask=None,
    rolePermissions=None,
    accessRestrictions=0,
    isAbstract=False,
    symmetric=False,
    inverseName=None
)

Declare a custom OPC UA ReferenceType.

The decorated class is a metadata-only marker: it is never instantiated, and its Python base class becomes the HasSubtype parent, so class Controls(ns0.reftypes.NonHierarchicalReferences) declares a subtype of NonHierarchicalReferences. Annotated fields are rejected, because a ReferenceType has no wire layout. Pass the resulting class wherever a ReferenceType is expected, for example to o6.reference.

Parameters:

Name Type Description Default
ns Optional[str]

Shortname of the declaring namespace. Inferred from nodeId when that carries a namespace, otherwise required.

None
nodeId Optional[str]

NodeId of the ReferenceType node. Allocated in the declaring namespace when omitted.

None
browseName Optional[str]

BrowseName of the node. Defaults to the class name.

None
displayName Optional[str]

DisplayName of the node. Defaults to the BrowseName.

None
description Optional[str]

Description attribute. Defaults to the class docstring.

None
writeMask Optional[bool]

WriteMask attribute of the node.

None
userWriteMask Optional[bool]

UserWriteMask attribute of the node.

None
rolePermissions Optional[Mapping[Any, int]]

RolePermissions, as a mapping of role to o6.Permission mask.

None
accessRestrictions int

AccessRestrictions attribute of the node.

0
isAbstract bool

Declare the ReferenceType abstract, so only its subtypes may be used in references.

False
symmetric bool

Declare the reference symmetric, which means it reads the same in both directions and has no separate InverseName.

False
inverseName Optional[str]

InverseName attribute, the name of the reverse direction. Required by OPC UA for a non-symmetric, non-abstract ReferenceType.

None

Raises:

Type Description
TypeError

The decorated object is not a class, or the class has annotated fields.

See @o6.referencetype — custom references.