File
Commands that provide access to logger instrument data and functions.
List Directory
List a directory on the device.
Command
- file - (Array<Object>) - An array of file commands
- command - (String) - The List Directory command: “listdir”
- type - (String) - The type of storage. Valid options are returned by storageGetLocations
- path - (String) - The path to the directory to list
Response
- file - (Array<Object>) - An array of file commands
- command - (String) - The List Directory command: “listdir”
- statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
- wait - (Integer) - The number of ms to wait before the device is ready to process another command.
- type - (String) - The type of storage. Valid options are returned by storageGetLocations
- path - (String) - The path to the directory to list
Example
Command
{
"file": [{
"command": "listdir",
"type": "sd0",
"path": "/"
}]
}
Response
{
"file": [{
"command": "listdir",
"statusCode": 0,
"files": ["fileone.txt", "filetwo.bin"],
"type": "sd0",
"path": "/",
"wait": 0
}]
}
Write
Write a file.
Command
- file - (Array<Object>) - An array of file commands
- command - (String) - The Write command: “write”
- type - (String) - The storage type (sd0, flash, etc)
- path - (String) - The desired path of the file
- filePosition - (String) - What index to start writing the file
- binaryOffset - (Integer) - The offset in the binary chunk where the corresponding data starts
- binaryLength - (Integer) - The length of the data in the binary chunk
Response
- file - (Array<Object>) - An array of file commands
- command - (String) - The List Directory command: “write”
- statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
- wait - (Integer) - The number of ms to wait before the device is ready to process another command.
- actualFilePosition - (Integer) - The actual file position
- binaryLength - (Integer) - The length of the binary data in the binary chunk
- binaryOffset - (Integer) - The offset in the binary chunk where the corresponding data starts
- path - (String) - The path of the file
- type - (String) - The storage type (sd0, flash, etc)
Example
Command
80\r\n
{
"file": [{
"command":"write",
"type":"flash",
"path":"hardprofiledata.json",
"filePosition":0,
"binaryOffset":0,
"binaryLength":434
}]
}\r\n
1b2\r\n
<Binary Data>
0\r\n
\r\n
Response
{
"file": [{
"command":"write",
"statusCode":0,
"type":"flash",
"path":"hardprofiledata.json",
"actualFilePosition":0,
"binaryOffset":0,
"binaryLength":434,
"wait":0
}]
}
Read
Read a file.
Command
- file - (Array<Object>) - An array of file commands
- command - (String) - The Read command: “read”
- type - (String) - The storage type (sd0, flash, etc)
- path - (String) - The desired path of the file
- filePosition - (String) - What index to start writing the file
- requestedLength - (Integer) - The desired length to read
Response
- file - (Array<Object>) - An array of file commands
- command - (String) - The Read command: “read”
- statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
- wait - (Integer) - The number of ms to wait before the device is ready to process another command.
- actualFilePosition - (Integer) - The actual file position
- actualLength - (Integer) - The actual number of bytes read
- binaryLength - (Integer) - The length of the binary data in the binary chunk
- binaryOffset - (Integer) - The offset in the binary chunk where the corresponding data starts
- path - (String) - The path of the file
- type - (String) - The storage type (sd0, flash, etc)
Example
Command
{
"file": [{
"command":"read",
"type":"flash",
"path":"hardprofiledata.json",
"filePosition":0,
"requestedLength":-1
}]
}
Response
80\r\n
{
"file": [{
"command":"read",
"statusCode":0,
"type":"flash",
"path":"hardprofiledata.json",
"actualFilePosition":0,
"actualLength":-1,
"binaryOffset":0,
"binaryLength":454,
"wait":0
}]
}\r\n
1B2\r\n
<Binary Data>
0\r\n
\r\n
Get File Size
Delete a file on the device.
Command
- file - (Array<Object>) - An array of file commands
- command - (String) - The Get File Size command: “getFileSize”
- type - (String) - The type of storage. Valid options are returned by storageGetLocations
- path - (String) - The path to the directory to list
Response
- file - (Array<Object>) - An array of file commands
- command - (String) - The Get File Size command: “getFileSize”
- statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
- wait - (Integer) - The number of ms to wait before the device is ready to process another command.
- type - (String) - The type of storage. Valid options are returned by storageGetLocations
- path - (String) - The path to the directory to list
- actualFileSize - (Integer) - The actual file size
Example
Command
{
"file":[{
"command":"getFileSize",
"type":"sd0",
"path":"ch1.dlog"
}]
}
Response
{
"file":[{
"command":"getFileSize",
"statusCode":0,
"type":"sd0",
"path":"ch1.dlog",
"actualFileSize":4070,
"wait":0
}]
}
Delete
Delete a file on the device.
Command
- file - (Array<Object>) - An array of file commands
- command - (String) - The Delete File command: “delete”
- type - (String) - The type of storage. Valid options are returned by storageGetLocations
- path - (String) - The path to the directory to list
Response
- file - (Array<Object>) - An array of file commands
- command - (String) - The Delete File command: “delete”
- statusCode - (Integer) - A numeric value representing the device status. See Digilent Instrumentation Protocol Status Codes
- wait - (Integer) - The number of ms to wait before the device is ready to process another command.
- type - (String) - The type of storage. Valid options are returned by storageGetLocations
- path - (String) - The path to the directory to list
Example
Command
{
"file": [{
"command": "delete",
"type": "sd0",
"path": "garbage.txt"
}]
}
Response
{
"file": [{
"command": "delete",
"statusCode": 0,
"type": "sd0",
"path": "garbage.txt",
"wait": 0
}]
}

