opcua-solution-net icon indicating copy to clipboard operation
opcua-solution-net copied to clipboard

Write local file to FileType object

Open BrunoTrevisani opened this issue 1 year ago • 3 comments

Type of Issue

  • [ ] Issue
  • [ ] Change
  • [ ] Enhancement
  • [X] Question
  • [X] Help wanted

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

BrunoTrevisani avatar Feb 14 '24 16:02 BrunoTrevisani

Please check the Supported Profiles for servers at https://github.com/technosoftware-gmbh/opcua-solution-net/blob/master/documentation/UaServer/SupportedProfiles.md

The File Access Server Facet is not yet supported

technosoftware avatar Feb 14 '24 18:02 technosoftware

Do you intend to implement File Access Server in the future? Do you have any dates?

BrunoTrevisani avatar Feb 14 '24 19:02 BrunoTrevisani

We have to check the effort for this feature but based on your example we are not sure if that is done correct. Seems you add a FileState to a method but FileState itself needs the implementation of several methods like Open, Close, Read which seems not to be done in this example. See also FileType.

technosoftware avatar Feb 16 '24 06:02 technosoftware