This ObjectTypedefines a type for files. It is formally defined in Table 1.

Table 1– FileType

Attribute

Value

BrowseName

FileType

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the BaseObjectType defined in OPC 10000-5

HasProperty

Variable

Size

UInt64

PropertyType

Mandatory

HasProperty

Variable

Writable

Boolean

PropertyType

Mandatory

HasProperty

Variable

UserWritable

Boolean

PropertyType

Mandatory

HasProperty

Variable

OpenCount

UInt16

PropertyType

Mandatory

HasProperty

Variable

MimeType

String

PropertyType

Optional

HasComponent

Method

Open

Defined in 4.2.2

Mandatory

HasComponent

Method

Close

Defined in 4.2.3

Mandatory

HasComponent

Method

Read

Defined in 4.2.4

Mandatory

HasComponent

Method

Write

Defined in 4.2.5

Mandatory

HasComponent

Method

GetPosition

Defined in 4.2.6

Mandatory

HasComponent

Method

SetPosition

Defined in 4.2.7

Mandatory

HasProperty

Variable

MaxByteStringLength

UInt32

PropertyType

Optional

HasProperty

Variable

LastModifiedTime

DateTime

PropertyType

Optional

Conformance Units

Base Info FileType Base

Sizedefines the size of the file in Bytes. When a file is opened for write the size might not be accurate. If the Servercan not accurately determine the size of the file, the Size Propertyshall be returned to a Clientwith a StatusCodeof Bad_NotSupported.

Writableindicates whether the file is writable. It does not take any user access rights into account, i.e. although the file is writable this may be restricted to a certain user / user group. The Propertydoes not consider whether the file is currently opened for writing by another client and thus currently locked and not writable by others.

UserWritableindicates whether the file is writable taking user access rights into account. The Property does not consider whether the file is currently opened for writing by another client and thus currently locked and not writable by others.

OpenCountindicates the number of currently valid file handles on the file.

The optional Property MimeTypecontains the media type of the file based on RFC 2046.

Note that all Methodson a file require a fileHandle, which is returned in the Open Method.

The optional MaxByteStringLength Propertyindicates the maximum number of bytes of the read and write buffers. If this Propertyis not present then the maximum size is defined by the MaxByteStringLength Propertyof the ServerCapabilitiesTypedefined in OPC 10000-5.

The optional LastModifiedTime Propertyindicates the time the file was last modified. The Propertyshall be updated whenever the Serverdetects that the file has changed.

Open is used to open a file represented by an Objectof FileType. When a client opens a file it gets a file handle that is valid while the session is open. Clients shall use the Close Methodto release the handle when they do not need access to the file anymore. Clients can open the same file several times for read. A request to open for writing shall return Bad_NotWritable when the file is already opened. A request to open for reading shall return Bad_NotReadable when the file is already opened for writing.

Signature

Open(

[in] Byte mode

[out] UInt32 fileHandle

);

Argument

Description

mode

Indicates whether the file should be opened only for read operations or for read and write operations and where the initial position is set.

The modeis an 8-bit unsigned integer used as bit mask with the structure defined in the following table:

Field

Bit

Description

Read

0

The file is opened for reading. If this bit is not set the Read Method cannot be executed.

Write

1

The file is opened for writing. If this bit is not set the Write Method cannot be executed.

EraseExisting

2

This bit can only be set if the file is opened for writing (Write bit is set). The existing content of the file is erased and an empty file is provided.

Append

3

When the Append bit is set the file is opened at end of the file, otherwise at begin of the file. The SetPosition Method can be used to change the position.

Reserved

4:7

Reserved for future use. Shall always be zero.

fileHandle

A handle for the file used in other method calls indicating not the file (this is done by the Object of the Method call) but the access request and thus the position in the file. The fileHandle is generated by the server and is unique for the Session. Clients cannot transfer the fileHandle to another Session but need to get a new fileHandle by calling the Open Method.

Method Result Codes (defined in Call Service)

Result Code

Description

Bad_NotReadable

See OPC 10000-4for a general description. File might be locked and thus not readable.

Bad_NotWritable

See OPC 10000-4for a general description.

Bad_InvalidState

See OPC 10000-4for a general description. The file is locked and thus not writable.

Bad_InvalidArgument

See OPC 10000-4for a general description. Mode setting is invalid.

Bad_NotFound

See OPC 10000-4for a general description.

Bad_UnexpectedError

See OPC 10000-4for a general description.

Table 2specifies the AddressSpacerepresentation for the Open Method.

Table 2– Open Method AddressSpace definition

Attribute

Value

BrowseName

Open

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

HasProperty

Variable

InputArguments

Argument[]

PropertyType

Mandatory

HasProperty

Variable

OutputArguments

Argument[]

PropertyType

Mandatory

Conformance Units

Base Info FileType Base

Close is used to close a file represented by a FileType. When a client closes a file the handle becomes invalid.

Signature

Close(

[in] UInt32 fileHandle

);

Argument

Description

fileHandle

A handle indicating the access request and thus indirectly the position inside the file.

Method Result Codes (defined in Call Service)

Result Code

Description

Bad_InvalidArgument

See OPC 10000-4for a general description. Invalid file handle in call.

Table 3specifies the AddressSpacerepresentation for the Close Method.

Table 3– Close Method AddressSpace definition

Attribute

Value

BrowseName

Close

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

HasProperty

Variable

InputArguments

Argument[]

PropertyType

Mandatory

Conformance Units

Base Info FileType Base

Read is used to read a part of the file starting from the current file position. The file position is advanced by the number of bytes read.

Signature

Read(

[in] UInt32 fileHandle

[in] Int32 length

[out] ByteString data

);

Argument

Description

fileHandle

A handle indicating the access request and thus indirectly the position inside the file.

Length

Defines the length in bytes that should be returned in data, starting from the current position of the file handle. If the end of file is reached all data until the end of the file is returned. The Serveris allowed to return less data than specified length.

Only positive values are allowed.

Data

Contains the returned data of the file. If the ByteString is empty it indicates that the end of the file is reached.

Method Result Codes (defined in Call Service)

Result Code

Description

Bad_InvalidArgument

See OPC 10000-4Invalid file handle in call or non-positive length.

Bad_UnexpectedError

See OPC 10000-4for a general description.

Bad_InvalidState

See OPC 10000-4for a general description. File was not opened for read access.

Table 4specifies the AddressSpacerepresentation for the Read Method.

Table 4– Read Method AddressSpace definition

Attribute

Value

BrowseName

Read

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

HasProperty

Variable

InputArguments

Argument[]

PropertyType

Mandatory

HasProperty

Variable

OutputArguments

Argument[]

PropertyType

Mandatory

Conformance Units

Base Info FileType Base

Write is used to write a part of the file starting from the current file position. The file position is advanced by the number of bytes written.

Signature

Write(

[in] UInt32 fileHandle

[in] ByteString data

);

Argument

Description

fileHandle

A handle indicating the access request and thus indirectly the position inside the file.

data

Contains the data to be written at the position of the file. It is server-dependent whether the written data are persistently stored if the session is ended without calling the Close Method with the fileHandle.

Writing an empty or null ByteStringreturns a Good result code without any affect on the file.

Method Result Codes (defined in Call Service)

Result Code

Description

Bad_InvalidArgument

See OPC 10000-4for a general description. Invalid file handle in call.

Bad_NotWritable

See OPC 10000-4for a general description. File might be locked and thus not writable.

Bad_InvalidState

See OPC 10000-4for a general description. File was not opened for write access.

Table 5specifies the AddressSpacerepresentation for the Write Method.

Table 5– Write Method AddressSpace definition

Attribute

Value

BrowseName

Write

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

HasProperty

Variable

InputArguments

Argument[]

PropertyType

Mandatory

Conformance Units

Base Info FileType Base

GetPosition is used to provide the current position of the file handle.

Signature

GetPosition(

[in] UInt32 fileHandle

[out] UInt64 position

);

Argument

Description

fileHandle

A handle indicating the access request and thus indirectly the position inside the file.

Position

The position of the fileHandle in the file. If a Read or Write is called it starts at that position.

Method Result Codes (defined in Call Service)

Result Code

Description

Bad_InvalidArgument

See OPC 10000-4for a general description. Invalid file handle in call.

Table 6specifies the AddressSpacerepresentation for the GetPosition Method.

Table 6– GetPosition Method AddressSpace definition

Attribute

Value

BrowseName

GetPosition

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

HasProperty

Variable

InputArguments

Argument[]

PropertyType

Mandatory

HasProperty

Variable

OutputArguments

Argument[]

PropertyType

Mandatory

Conformance Units

Base Info FileType Base

SetPosition is used to set the current position of the file handle.

Signature

SetPosition(

[in] UInt32 fileHandle

[in] UInt64 position

);

Argument

Description

fileHandle

A handle indicating the access request and thus indirectly the position inside the file.

Position

The position to be set for the fileHandle in the file. If a Read or Write is called it starts at that position. If the position is higher than the file size the position is set to the end of the file.

Method Result Codes (defined in Call Service)

Result Code

Description

Bad_InvalidArgument

See OPC 10000-4for a general description. Invalid file handle in call.

Table 7specifies the AddressSpacerepresentation for the SetPosition Method.

Table 7– SetPosition Method AddressSpace definition

Attribute

Value

BrowseName

SetPosition

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

HasProperty

Variable

InputArguments

Argument[]

PropertyType

Mandatory

Conformance Units

Base Info FileType Base