start-disk-test

Added at V2.2 Use the interface to test whether the write speed meets the requirements for recording. You can call the stop-disk-test to cancel the request during testing.

Prerequisites are as follows.

  • firmware update is not in progress
  • reset and reboot is not in progress
  • recording is not in progress
  • disk format is not in progress
  • disk performance test is not in progress
  • disk is valid to work
  • disk has more than 200M free space
  • disk is writable

Obtain the mask of device status and disk status using get-status.

"cur-status": 65552                    // device running status mask
"usb": {
  "disk-status": 1,                    // disk status mask
  "total-size": 61638148096,
  "used-size": 97058816,
  ...
}

The output of cur-status & Device Status Mask are as follows.

Device status Condition
Firmware update is not in progress cur-status & statusUpgrade != statusUpgrade
Reset all settings is not in progress cur-status & statusReset != statusReset
Reboot is not in progress cur-status & statusReboot != statusReboot
Recording is not in progress cur-status & statusRecord != statusRecord
Disk format is not in progress cur-status & statusFormatDisk != statusFormatDisk
Disk performance test is not in progress cur-status & statusDiskTest != statusDiskTest

The output of disk-status & disk Status are as follows.

Device status Condition
Disk is valid to work disk-status & DiskValid = DiskValid
Disk has more then 200 M free space disk-status & LowSpace != LowSpace
Disk is writable disk-status & NotWrite != NotWrite

HTTP Request

GET http://ip/usapi?method=start-disk-test&disk-type
Parameter Description
method start-disk-test
disk-type 0: USB flash drive, 1: SD card

Response Body

{
  "result": 0
}
Item Description
result Returned status.
0 indicates that the formatting begins.
1 indicates repeat request
-5 indicates disk error.
-9 indicates system busy.
-16 indicates there is not enough free space.
Refer to API Status Codes to find specific description for other values.

The Lowest Required Write Speed (requirSpeed)

Obtain the recording configurations using get-settings.

"rec-stream": 0,
"main-stream": {
  "kbps": 4096,
  ...
},
"sub-stream": {
  "kbps": 1024,
  ...
}
"audio": {
  "kbps": 128
  ...
}

rec-stream indicates the recording stream type. 0 indicates main-stream, 1 indicates sub-stream.

The current recording requirSpeed can be calculated with the above information.

requirSpeed = main-stream.kbps + audio.kbps 
            = (4096 Kbps + 128 Kbps)
            = 4224 Kbps / 1024 * 8
            ≈ 0.52 MB/S

Performance Test Status

Obtain the disk-test information using get-status.

"disk-test": {
  "read-bps": 0,
  "write-bps": 14833071,    // 14833071 bps / 1024 * 1024 ≈ 14.15 MB/S
  "percent": 3,
  "result": 2,
  "client-id": "web-session-32435088"
}
Item Description
result Returned status.
27 indicates that the device is in initial status.
5 indicates the request is canceled.
2 indicates the test is in progress.
Returned status.
0 indicates that the request was accepted successfully. Refer to API Status Codes to find specific description for other values.
percent Indicates the percentage of test.
read-bps Indicates current read speed.
write-bps Indicates current write speed, if it is greater than requirSpeed, then the performance of the USB flash drive is up to standard.
client-id Reserved

Call the clear-disk-test to reset the device to the initial status (retInit=27) after the performance test is completed.

results matching ""

    No results matching ""

    results matching ""

      No results matching ""