Open is used to open a file represented by an Object of 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 Method to 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 mode is an 8-bit unsigned integer used as bit mask with the structure defined in the following table:
|
||||||||||||||||||
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-4 for a general description. File might be locked and thus not readable. |
Bad_NotWritable |
See OPC 10000-4 for a general description. |
Bad_InvalidState |
See OPC 10000-4 for a general description. The file is locked and thus not writable. |
Bad_InvalidArgument |
See OPC 10000-4 for a general description. Mode setting is invalid. |
Bad_NotFound |
See OPC 10000-4 for a general description. |
Bad_UnexpectedError |
See OPC 10000-4 for a general description. |
Table 2 specifies the AddressSpace representation 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 |