C++ UA Server SDK
1.5.2.336
|
This class is a proxy class for access to a FileType Object in the server. More...
#include <uafileobject.h>
Inherited by UaClientSdk::InternalTrustList.
Public Member Functions | |
UaFileObject (UaSession *pSession) | |
Constructs a File object used to access a FileType object on the server. More... | |
virtual | ~UaFileObject () |
Destroys the File object. | |
void | attachToOpenFile (const UaNodeId &fileObjectNodeId, OpcUa_UInt32 fileHandle) |
Used to attach the file object to an already open a file in the server. More... | |
UaStatus | open (ServiceSettings &serviceSettings, const UaNodeId &fileObjectNodeId, OpcUa_Byte mode) |
Used to open a file represented by an Object of FileType. More... | |
UaStatus | close (ServiceSettings &serviceSettings) |
Used to close the file. More... | |
UaStatus | read (ServiceSettings &serviceSettings, OpcUa_Int32 length, UaByteString &data) |
Used to read from the file. More... | |
UaStatus | write (ServiceSettings &serviceSettings, const UaByteString &data) |
Used to write to the file. More... | |
UaStatus | getPosition (ServiceSettings &serviceSettings, OpcUa_UInt64 &position) |
Used to get the position in the file. More... | |
UaStatus | setPosition (ServiceSettings &serviceSettings, OpcUa_UInt64 position) |
Used to set the position in the file. More... | |
OpcUa_UInt32 | fileHandle () const |
Returns the file open handle for the file object. | |
UaNodeId | fileObjectNodeId () const |
Returns the NodeId for the server side file object. | |
This class is a proxy class for access to a FileType Object in the server.
UaClientSdk::UaFileObject::UaFileObject | ( | UaSession * | pSession | ) |
Constructs a File object used to access a FileType object on the server.
A UaSession connected to the server must be passed in. Some of the methods on the server may not require a special user, however most of the methods require special Client’s user credentials. Therefore it is required to configure the UaSession object with the right user token.
[in] | pSession | The UaSession object used to communicate with the server |
void UaClientSdk::UaFileObject::attachToOpenFile | ( | const UaNodeId & | fileObjectNodeId, |
OpcUa_UInt32 | fileHandle | ||
) |
Used to attach the file object to an already open a file in the server.
This method can be used to attach to a file opened during creation of the file on the server with the FileDirectoryType.
[in] | fileObjectNodeId | NodeId of the FileType object of the server |
[in] | fileHandle | File handle for the opened file in the server |
UaStatus UaClientSdk::UaFileObject::close | ( | ServiceSettings & | serviceSettings | ) |
Used to close the file.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details. |
UaStatus UaClientSdk::UaFileObject::getPosition | ( | ServiceSettings & | serviceSettings, |
OpcUa_UInt64 & | position | ||
) |
Used to get the position in the file.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details. |
[in] | position | The position of this proxy object in the file. If read or write is called, it starts at that position. |
UaStatus UaClientSdk::UaFileObject::open | ( | ServiceSettings & | serviceSettings, |
const UaNodeId & | fileObjectNodeId, | ||
OpcUa_Byte | mode | ||
) |
Used to open a file represented by an Object of FileType.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details. | ||||||||||||||||||||
[in] | fileObjectNodeId | NodeId of the FileType object of the server | ||||||||||||||||||||
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:
|
UaStatus UaClientSdk::UaFileObject::read | ( | ServiceSettings & | serviceSettings, |
OpcUa_Int32 | length, | ||
UaByteString & | data | ||
) |
Used to read from the file.
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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details. |
[in] | length | Defines the length in bytes that should be returned in data, starting from the current position of the file object. If the end of file is reached all data until the end of the file is returned. The Server is allowed to return less data than specified length. Only positive values are allowed. |
[out] | data | Contains the returned data of the file. If the ByteString is empty it indicates that the end of the file is reached. |
UaStatus UaClientSdk::UaFileObject::setPosition | ( | ServiceSettings & | serviceSettings, |
OpcUa_UInt64 | position | ||
) |
Used to set the position in the file.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details. |
[in] | position | The position to be set for this proxy object in the file. If 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. |
UaStatus UaClientSdk::UaFileObject::write | ( | ServiceSettings & | serviceSettings, |
const UaByteString & | data | ||
) |
Used to write to the file.
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.
[in,out] | serviceSettings | The general service settings like timeout. See ServiceSettings for more details. |
[in] | 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. |