OPCFoundation / UA-.NETStandard-Samples

Other
244 stars 179 forks source link

Write local file to FileType object #593

Open BrunoTrevisani opened 4 months ago

BrunoTrevisani commented 4 months ago

Type of issue

Current Behavior

Hello,

I'm trying to write a local file to a FileType object in my AddressSpace, but it always returns a BadNotImplemented error.

I also tried using the create file method to create the file object with a local file loaded, but without success.

Below is the code I used to create the objects. Does anyone know what it needs to write a local file to a FileType object and/or load a file via the Create File method?

private ServiceResult OnCreateFileMethodCall(ISystemContext _context, MethodState _method, NodeId _objectId, string fileName, bool requestFileOpen, ref NodeId fileNodeId, ref uint fileHandle)
{
    NodeState parent = _method.Parent;

    FileState fileState = new FileState(parent);
    fileState.SymbolicName = fileName;
    fileState.ReferenceTypeId = ReferenceTypes.Organizes;

    fileState.Create(SystemContext,
                     null,
                     new QualifiedName(fileName, NamespaceIndex),
                     new LocalizedText("en", fileName),
                     true);

    fileNodeId = fileState.NodeId;
    fileHandle = fileState.NumericId;

    parent.AddChild(fileState);
    opcServer_.AddNode(fileState);
    AddPredefinedNode(SystemContext, parent);

    return ServiceResult.Good;
}

Expected Behavior

No response

Steps To Reproduce

No response

Environment

- OS:
- Environment:
- Runtime:
- Nuget Version:
- Component:
- Server:
- Client:

Anything else?

No response