Skip to main content
Version: 2.6

OKUMA Device Commands

OKUMA Control Driver offers several commands for file management.

Overview

Command AddressDescription
Nc1.OpenFileStreamOpens a dnc stream for reading or writing.
Nc1.CloseFileStreamCloses a dnc stream
Nc1.ReadFileStreamReads from the dnc stream
Nc1.WriteFileStreamWrite to the dnc stream
Nc1.GetFileStreamStatusGets the status of the dnc stream
Nc1.DeleteFileDeletes a file on the system.
Command AddressDescription
Nc1.CreateDirectoryCreates a new directory.
Nc1.DeleteDirectoryDeletes a directory.
Nc1.GetCurrentDirectoryGets the current directory.
Nc1.ChangeDirectoryChanges the current directory.
Nc1.ReadDirectoryReads the content of the directory.

OpenFileStream

Opens the dnc stream for reading or writing depending on the AccessMode.

Address: Nc1.OpenFileStream

ArgumentDirectionDescriptionData Type
NameInputProgram or filenameSystem.String
AsyncTokenInput [OPT]Token for async callbackSystem.Int32
AccessModeInputAccess mode (Read or Write)System.Int32
HandleOutputFile handleSystem.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

ArgumentDirectionDescriptionData Type
AsyncTokenInput [OPT]Token for async callbackSystem.Int32
HandleInputFile handleSystem.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

ArgumentDirectionDescriptionData Type
HandleInputFile handleSystem.Int32
MaxBytesInputMaximum number of bytesSystem.Int32
ContentOutputContentSystem.Byte[]
LastContentOutputFlag 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

ArgumentDirectionDescriptionData Type
HandleInputFile handleSystem.Int32
ContentInputContentSystem.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

ArgumentDirectionDescriptionData Type
HandleInputStream handleSystem.Int32
ContentOutputContent (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

ArgumentDirectionDescriptionData Type
NameInputProgram or filenameSystem.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

ArgumentDirectionDescriptionData Type
NameInputDirectory nameSystem.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

ArgumentDirectionDescriptionData Type
NameInputDirectory nameSystem.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

ArgumentDirectionDescriptionData Type
NameOutputDirectory nameSystem.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

ArgumentDirectionDescriptionData Type
NameInputDirectory nameSystem.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

ArgumentDirectionDescriptionData Type
NameInputdirectory name. If empty, the current directory is returned.System.String
ContentOutputJSON formatted directory contentSystem.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"
}
]
}