OKUMA Device Commands
OKUMA Control Driver offers several commands for file management.
Overview
Command Address | Description |
---|---|
Nc1.OpenFileStream | Opens a dnc stream for reading or writing. |
Nc1.CloseFileStream | Closes a dnc stream |
Nc1.ReadFileStream | Reads from the dnc stream |
Nc1.WriteFileStream | Write to the dnc stream |
Nc1.GetFileStreamStatus | Gets the status of the dnc stream |
Nc1.DeleteFile | Deletes a file on the system. |
Command Address | Description |
---|---|
Nc1.CreateDirectory | Creates a new directory. |
Nc1.DeleteDirectory | Deletes a directory. |
Nc1.GetCurrentDirectory | Gets the current directory. |
Nc1.ChangeDirectory | Changes the current directory. |
Nc1.ReadDirectory | Reads the content of the directory. |
OpenFileStream
Opens the dnc stream for reading or writing depending on the AccessMode
.
Address: Nc1.OpenFileStream
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Program or filename | System.String |
AsyncToken | Input [OPT] | Token for async callback | System.Int32 |
AccessMode | Input | Access mode (Read or Write) | System.Int32 |
Handle | Output | File handle | System.Int32 |
See DNC Model - OpenFileStream for details on arguments and return values.
Example:
{
"Id": "<generate your own id>",
"Name": "OpenFileStream",
"Type": "CommandNode",
"Address": "Nc1.OpenFileStream",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String"
},
{
"Name": "AccessMode",
"Type": "Input",
"DataType": "System.Int32"
},
{
"Name": "Handle",
"Type": "Output",
"DataType": "System.Int32"
}
]
}
CloseFileStream
Closes the dnc stream for reading or writing.
Address: Nc1.CloseFileStream
Argument | Direction | Description | Data Type |
---|---|---|---|
AsyncToken | Input [OPT] | Token for async callback | System.Int32 |
Handle | Input | File handle | System.Int32 |
See DNC Model - CloseFileStream for details on arguments and return values.
Example:
{
"Id": "5608D2DA-7CAF-416A-B31F-42DF706B9FD0",
"Name": "CloseFileStream",
"Address": "Nc1.CloseFileStream",
"ScriptFile": "",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Handle",
"DataType": "System.Int32",
"Description": ""
}
]
}
ReadFileStream
Reads from a dnc stream
Address: Nc1.ReadFileStream
Argument | Direction | Description | Data Type |
---|---|---|---|
Handle | Input | File handle | System.Int32 |
MaxBytes | Input | Maximum number of bytes | System.Int32 |
Content | Output | Content | System.Byte[] |
LastContent | Output | Flag is the last content has been sent. | System.Boolean |
See DNC Model - ReadFileStream for details on arguments and return values.
Example:
{
"Id": "C71D6C63-6EEF-4020-98CC-6F3085AF4478",
"Name": "ReadFileStream",
"Address": "Nc1.ReadFileStream",
"ScriptFile": "",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Handle",
"DataType": "System.Int32",
"Description": ""
},
{
"Name": "MaxBytes",
"DataType": "System.Int32",
"Description": ""
},
{
"Name": "Content",
"DataType": "System.Byte[]",
"Type": "Output",
"Description": ""
},
{
"Name": "LastContent",
"DataType": "System.Boolean",
"Type": "Output",
"Description": ""
}
]
}
WriteFileStream
Writes to a dnc stream
Address: Nc1.WriteFileStream
Argument | Direction | Description | Data Type |
---|---|---|---|
Handle | Input | File handle | System.Int32 |
Content | Input | Content | System.Byte[] |
See DNC Model - WriteFileStream for details on arguments and return values.
Example:
{
"Id": "5AAB615E-8663-4B9F-95E2-221317F65E3F",
"Name": "WriteFileStream",
"Address": "Nc1.WriteFileStream",
"ScriptFile": "",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Handle",
"DataType": "System.Int32",
"Description": ""
},
{
"Name": "Content",
"DataType": "System.Byte[]",
"Description": ""
}
]
}
GetFileStreamStatus
Gets the status of the dnc stream
Address: Nc1.GetFileStreamStatus
Argument | Direction | Description | Data Type |
---|---|---|---|
Handle | Input | Stream handle | System.Int32 |
Content | Output | Content (JSON formatted) | System.String |
See DNC Model - GetFileStreamStatus for details on arguments and return values.
Example:
{
"Id": "5AAB615E-8663-4B9F-95E2-221317F65E3F",
"Name": "GetFileStreamStatus",
"Address": "Nc1.GetFileStreamStatus",
"ScriptFile": "",
"Type": "CommandNode",
"Arguments": [
{
"Name": "Handle",
"DataType": "System.Int32",
"Description": ""
},
{
"Name": "Content",
"DataType": "System.String",
"Type": "Output",
"Description": ""
}
]
}
DeleteFile
Deletes a specific nc file within the selected Nc directory.
Address: Nc1.DeleteFile
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Program or filename | System.String |
Example:
{
"Id": "<generate your own id>",
"Name": "DeleteFile",
"Type": "CommandNode",
"Address": "Nc1.DeleteFile",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String",
"Description": "Program Name"
}
]
}
MakeDirectory
Creates a sub directory.
Address: Nc1.CreateDirectory
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Directory name | System.String |
Example:
{
"Id": "<generate your own id>",
"Name": "MakeDirectory",
"Type": "CommandNode",
"Address": "Nc1.CreateDirectory",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String"
}
]
}
DeleteDirectory
Deletes a sub directory within the selected Nc directory.
Address: Nc1.DeleteDirectory
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Directory name | System.String |
Example:
{
"Id": "<generate your own id>",
"Name": "DeleteDirectory",
"Type": "CommandNode",
"Address": "Nc1.deleteDirectory",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String"
}
]
}
GetCurrentDirectory
Gets the current directory of the Nc.
Address: Nc1.GetCurrentDirectory
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Output | Directory name | System.String |
Example:
{
"Id": "<generate your own id>",
"Name": "GetCurrentDirectory",
"Type": "CommandNode",
"Address": "Nc1.GetCurrentDirectory",
"Arguments": [
{
"Name": "Name",
"Type": "Output",
"DataType": "System.String"
}
]
}
SetCurrentDirectory
Sets the current directory of the Nc.
Address: Nc{n}.ChangeDirectory
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | Directory name | System.String |
Example:
{
"Id": "<generate your own id>",
"Name": "SetCurrentDirectory",
"Type": "CommandNode",
"Address": "Nc1.ChangeDirectory",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String"
}
]
}
ReadDirectory
Reads a directory content from the file system. The content is returned in a JSON format.
Address: Nc1.ReadDirectory
Argument | Direction | Description | Data Type |
---|---|---|---|
Name | Input | directory name. If empty, the current directory is returned. | System.String |
Content | Output | JSON formatted directory content | System.String |
Example from a device info file:
{
"Id": "<generate your own id>",
"Name": "ReadDirectory",
"Type": "CommandNode",
"Address": "Nc1.ReadDirectory",
"Arguments": [
{
"Name": "Name",
"Type": "Input",
"DataType": "System.String",
"Description": "Directory Name"
},
{
"Name": "Content",
"Type": "Output",
"DataType": "System.String",
"Description": "Directory Content"
}
]
}