start-disk-format

Added at V2.2

Use the interface to format the USB flash drive or SD card. The stored data cannot be recovered after formatting and the process can not be canceled.

Prerequisites are as follows.

  • firmware update is not in progress
  • neither reset nor reboot is in progress
  • recording is not enabled
  • USB flash drive or SD card is valid to work

Obtain the following information using get-status.

"cur-status": 65552                    // device running status mask
"disk-info": [
  {
    "disk-status": 1,                    // SD status mask
    "disk-type": 1,                      // 0: USB flash drive, 1: SD card
    "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 enabled cur-status & statusReboot != statusReboot
record is not in progress cur-status & statusRecord != statusRecord

The output of disk-status & Device Status code is as follows.

Device status Condition
USB flash drive or SD card is valid to work disk-status & DiskValid = DiskValid

HTTP Request

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

Response Body

{
  "result": 0
}
Item Description
result Returned status.
0 indicates that the USB starts to format.
1 indicates repeat request.
-5 indicates USB disk is error.
-9 indicates that system is busy.
Refer to API Status Codes to find specific description for other values.

Format Status

Obtain format-status using the get-status.

"format-status": {
  "result": 27,
  "percent": 20,
  "client-id": ""
}
Item Description
result Returned status.
27 indicates that formatting is in initial state.
2 indicates that formatting is ongoing.
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 formatting.
client-id Reserved

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

results matching ""

    No results matching ""

    results matching ""

      No results matching ""