UA Bundle SDK .NET
2.3.1.334
|
An object that represents a file that can be accessed via the server. More...
Inherits UnifiedAutomation.UaServer.BaseObjectModel, UnifiedAutomation.UaServer.IMethodDispatcher, UnifiedAutomation.UaServer.IFileMethods, and IDisposable.
Inherited by UnifiedAutomation.UaServer.AddressSpaceFileModel.
Classes | |
class | OpenFileHandle |
Caches information about an open file handle. More... | |
Public Member Functions | |
void | Dispose () |
Frees any unmanaged resources. More... | |
virtual StatusCode | Open (RequestContext context, FileModel model, byte mode, out uint fileHandle) |
Opens the specified file. More... | |
virtual StatusCode | Close (RequestContext context, FileModel model, uint fileHandle) |
Closes the specified file. More... | |
virtual StatusCode | Read (RequestContext context, FileModel model, uint fileHandle, int length, out byte[] data) |
Reads the specified file. More... | |
virtual StatusCode | Write (RequestContext context, FileModel model, uint fileHandle, byte[] data) |
Writes the specified file. More... | |
virtual StatusCode | SetPosition (RequestContext context, FileModel model, uint fileHandle, ulong position) |
Sets the current position of the file. More... | |
virtual StatusCode | GetPosition (RequestContext context, FileModel model, uint fileHandle, out ulong position) |
Returns the current position of the file. More... | |
FileModel () | |
Initializes a new instance of the FileModel class. More... | |
FileModel (FileModel template) | |
Initializes a new instance of the FileModel class. More... | |
virtual CallMethodEventHandler | GetMethodDispatcher (RequestContext context, NodeId objectId, NodeId methodId) |
Gets the method dispatcher. More... | |
virtual StatusCode | DispatchMethod (RequestContext context, MethodHandle methodHandle, IList< Variant > inputArguments, List< StatusCode > inputArgumentResults, List< Variant > outputArguments) |
Dispatches the method. More... | |
Public Member Functions inherited from UnifiedAutomation.UaServer.BaseObjectModel | |
BaseObjectModel () | |
Initializes a new instance of the BaseObjectModel class. More... | |
BaseObjectModel (BaseObjectModel template) | |
Initializes a new instance of the BaseObjectModel class. More... | |
Public Member Functions inherited from UnifiedAutomation.UaServer.ModelControllerBase | |
virtual ModelHandle | GetModelHandle (StringTable namespaceUris, object instance) |
Gets the metadata handle. More... | |
virtual DataValue | GetValue (IMapperContext context, ModelMapping mapping) |
Gets the value associated with the mapping. More... | |
virtual bool | SetValue (IMapperContext context, ModelMapping mapping, DataValue value) |
Sets the value associated with the mapping. More... | |
Protected Member Functions | |
virtual void | Dispose (bool disposing) |
An overrideable version of the Dispose. More... | |
void | CleanupExpiredHandles () |
Cleans up any expired handles. More... | |
StatusCode | OpenStream (OpenFileHandle handle) |
Opens a stream for the file referenced by FileOnDisk. More... | |
OpenFileHandle | FindHandle (RequestContext context, uint fileHandle) |
Finds the handle. More... | |
void | SaveHandle (OpenFileHandle handle) |
Assigns a unique id to the handle and saves the handle. More... | |
void | CloseHandle (OpenFileHandle handle) |
Closes the stream associated with the handle and sets the size of the File object. More... | |
Protected Attributes | |
object | Lock = new object() |
An object used to synchronize access to the file object. More... | |
Properties | |
FileInfo | FileOnDisk [get, set] |
Gets or sets the disk file which can be accessed via the file object. More... | |
int | MaxFileSize [get, set] |
Gets or sets the maximum size of the file in bytes. More... | |
uint | NextFileHandle [get, set] |
Gets or sets the next file handle to assign. More... | |
ushort | OpenCount [get, set] |
Gets or sets the OpenCount More... | |
ulong | Size [get, set] |
Gets or sets the Size More... | |
bool | UserWritable [get, set] |
Gets or sets the UserWritable More... | |
bool | Writable [get, set] |
Gets or sets the Writable More... | |
IFileMethods | FileMethods [get, set] |
Gets or sets the File methods. More... | |
Events | |
EventHandler< OpenFileEventArgs > | OpenRequested |
Occurs when the file is opened. More... | |
EventHandler< CloseFileEventArgs > | CloseRequested |
Occurs when the file is closed. More... | |
An object that represents a file that can be accessed via the server.
This ObjectType defines a type for files.
This class implements support for the FileType object on the server side.
Any number of open read handles is allowed but only one handle may be open for write at a time. Subclasses may be used to replace the FileStream with other abstract stream implementations. There are two events (OpenRequested and CloseRequested) which can be used to determine permissions.
See FileModel Example for example code.
Note that all Methods on a file require a FileHandle, which is returned in the UnifiedAutomation.UaServer.IFileMethods.Open Method.
|
inline |
Initializes a new instance of the FileModel class.
|
inline |
Initializes a new instance of the FileModel class.
template | The template. |
|
inlineprotected |
Cleans up any expired handles.
|
inlinevirtual |
Closes the specified file.
context | The context. |
model | The file model. |
fileHandle | The file handle returned by the Open method. |
Implements UnifiedAutomation.UaServer.IFileMethods.
|
inlineprotected |
Closes the stream associated with the handle and sets the size of the File object.
handle | The handle. |
|
inlinevirtual |
Dispatches the method.
context | The context. |
methodHandle | The method handle. |
inputArguments | The input arguments. |
inputArgumentResults | The input argument results. |
outputArguments | The output arguments. |
Reimplemented in UnifiedAutomation.UaServer.AddressSpaceFileModel.
|
inline |
Frees any unmanaged resources.
|
inlineprotectedvirtual |
An overrideable version of the Dispose.
|
inlineprotected |
Finds the handle.
context | The context. |
fileHandle | The file handle. |
|
inlinevirtual |
Gets the method dispatcher.
context | The context. |
objectId | The object id. |
methodId | The method id. |
Implements UnifiedAutomation.UaServer.IMethodDispatcher.
Reimplemented in UnifiedAutomation.UaServer.AddressSpaceFileModel.
|
inlinevirtual |
Returns the current position of the file.
context | The context. |
model | The file model. |
fileHandle | The file handle returned by the Open method (see UnifiedAutomation.UaServer.IFileMethods.GetPosition). |
position | The current position (see UnifiedAutomation.UaServer.IFileMethods.GetPosition). |
Implements UnifiedAutomation.UaServer.IFileMethods.
|
inlinevirtual |
Opens the specified file.
See UnifiedAutomation.UaServer.IFileMethods.Open for more information.
context | The context. |
model | The model. |
mode | The file access mode (see UnifiedAutomation.UaServer.IFileMethods.Open). The mode is described in the FileAccessModes enumeration. |
fileHandle | The file handle (see UnifiedAutomation.UaServer.IFileMethods.Open). The file handle has to be used for other methods of the FileModel like Close or Read. |
Implements UnifiedAutomation.UaServer.IFileMethods.
|
inlineprotected |
Opens a stream for the file referenced by FileOnDisk.
handle | The handle. |
|
inlinevirtual |
Reads the specified file.
context | The context. |
model | The model. |
fileHandle | The file handle returned by the Open method (see UnifiedAutomation.UaServer.IFileMethods.Read). |
length | The length (see UnifiedAutomation.UaServer.IFileMethods.Read). |
data | The returned data. |
Implements UnifiedAutomation.UaServer.IFileMethods.
|
inlineprotected |
Assigns a unique id to the handle and saves the handle.
handle | The handle. |
|
inlinevirtual |
Sets the current position of the file.
context | The context. |
model | The file model. |
fileHandle | The file handle returned by the Open method (see UnifiedAutomation.UaServer.IFileMethods.SetPosition). |
position | The new position (see UnifiedAutomation.UaServer.IFileMethods.SetPosition). |
Implements UnifiedAutomation.UaServer.IFileMethods.
|
inlinevirtual |
Writes the specified file.
See UnifiedAutomation.UaServer.IFileMethods.Write for more information.
context | The context. |
model | The file model. |
fileHandle | The file handle returned by the Open method (see UnifiedAutomation.UaServer.IFileMethods.Write). |
data | The data to write (see UnifiedAutomation.UaServer.IFileMethods.Write). |
Implements UnifiedAutomation.UaServer.IFileMethods.
|
protected |
An object used to synchronize access to the file object.
|
getset |
Gets or sets the File methods.
The File methods.
|
getset |
Gets or sets the disk file which can be accessed via the file object.
This should be null if a subclass implements a more complex I/O model.
|
getset |
Gets or sets the maximum size of the file in bytes.
|
getsetprotected |
Gets or sets the next file handle to assign.
|
getset |
Gets or sets the OpenCount
Indicates the number of currently valid file handles on the file.
|
getset |
Gets or sets the Size
Defines the size of the file in Bytes.
When a file is opened for writing and the FileHandle is still valid, the size might not be accurate.
|
getset |
Gets or sets the UserWritable
Indicates whether the file is writable, taking user access rights into account.
The Property does not take into account whether the file is currently opened for writing by another client and thus currently locked and not writable by others.
|
getset |
Gets or sets the Writable
Indicates 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 Property does not take into account whether the file is currently opened for writing by another client and thus currently locked and not writable by others.
EventHandler<CloseFileEventArgs> UnifiedAutomation.UaServer.FileModel.CloseRequested |
Occurs when the file is closed.
EventHandler<OpenFileEventArgs> UnifiedAutomation.UaServer.FileModel.OpenRequested |
Occurs when the file is opened.