Command Hardware Control – SD Card
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ID Control | Infor 1 | Infor 2 | Infor 3 | ... |
‘T’ | ‘S’ | PL2 | Control SD Card | 10 |
| ‘0’ | S_Start_SD_Card |
| |
‘1’ | S_Check_Folder_Exist |
| ||
‘2’ | S_Create_Folder |
| ||
‘3’ | S_Delete_File |
| ||
‘4’ | S_Rename_File |
| ||
‘5’ | S_Check_File_Exist |
| ||
‘6’ | S_Create_File |
| ||
‘7’ | S_Get_Size_File |
| ||
‘8’ | S_Read_Binary_data_File |
| ||
‘9’ | S_Append_Binary_data_to_File |
|
HOST send Control S_Start_SD_Card
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ‘0’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘0’ | STRING | - | - | 1 | 1 | ID Control : S_Start_SD_Card |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘0’ |
| ID Control : S_Start_SD_Card |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error : Card Mount Failed / Not found SD Card on SPI port | ||||||||
1 | OK : Start SD Card success | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|6|T|S|0|*6026 |
ACK Respond | $ESP_OK|67|T|S|0|1|Start SD Card Success , Card type:SD , Card size: 1802 MB |*485A |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control S_Check_Folder_Exist
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ‘1’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘1’ |
| ID Control : S_Check_Folder_Exist |
| ||||
| PL3 | STRING | - | - | 1 | 1500 | Path Folder |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘1’ |
| ID Control : S_Check_Folder_Exist |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | OK: Not exist (Not found this folder) | ||||||||
1 | OK: Existed | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|15|T|S|1|/my_test|*5D08 |
ACK Respond | $ESP_OK|16|T|S|1|1|Existed|*3318 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control S_Create_Folder
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ‘2’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘2’ |
| ID Control : S_Create_Folder |
| ||||
| PL3 | STRING | - | - | 3 | 1500 | Path of folder |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘2’ |
| ID Control : S_Create_Folder |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error : Create Folder failed | ||||||||
1 | OK: Create Folder Success | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|15|T|S|2|/my_test|*5E0B |
ACK Respond | $ESP_OK|30|T|S|2|1|Create Folder Success|*3708 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control S_Delete_File
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ‘3’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘3’ |
| ID Control : S_Delete_File |
| ||||
| PL3 | STRING | - | - | 3 | 1500 | Path of file |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘3’ |
| ID Control : S_Delete_File |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error : Error: Delete File failed | ||||||||
1 | OK : Delete File Success | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|21|T|S|3|/my_test/i.txt|*4877 |
ACK Respond | $ESP_OK|28|T|S|3|1|Delete File Success|*327F |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control S_Rename_File
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ‘4’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘4’ |
| ID Control : S_Rename_File |
| ||||
| PL3 | STRING | - | - | 2 | 1500 | Path file A |
|
| PL4 | STRING | - | - | 2 | 1500 | Path file B |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘4’ |
| ID Control : S_Rename_File |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error : Rename failed | ||||||||
1 | OK : File renamed success | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | Rename file i.txt to j.txt $ESP_OK|36|T|S|4|/my_test/i.txt|/my_test/j.txt|*546A |
ACK Respond | $ESP_OK|29|T|S|4|1|File renamed success|*594F |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control S_Check_File_Exist
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ‘5’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘5’ |
| ID Control : S_Check_File_Exist |
| ||||
| PL3 | STRING | - | - | 1 | 1500 | Path of file |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘5’ |
| ID Control : S_Check_File_Exist |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | Error : File path invalid or file not exist | ||||||||
0 | Error : Not exist - File not found | ||||||||
1 | OK: File Existed | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|21|T|S|5|/my_test/i.txt|*4E71 |
ACK Respond | $ESP_OK|16|T|S|5|1|Existed|*3718 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control S_Create_File
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ‘6’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘6’ |
| ID Control : S_Create_File |
| ||||
| PL3 | STRING | - | - | 1 | 1500 | Path of file create |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘6’ |
| ID Control : S_Create_File |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error: Create File failed | ||||||||
1 | OK: Create File Success | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|21|T|S|6|/my_test/i.txt|*4D72 |
ACK Respond | $ESP_OK|28|T|S|6|1|Create File Success|*2A6C |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control S_Get_Size_File
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ‘7’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘7’ |
| ID Control : S_Get_Size_File |
| ||||
| PL3 | STRING | - | - | 1 | 1500 | Path of |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value |
|
| Describe | Unit | ||
PL2 | ‘7’ |
| ID Control : S_Get_Size_File |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error : Failed open file for read size | ||||||||
1 | OK | ||||||||
| PL4 | INTEGER | 0 | 10000000000 | - | - | Size of file | byte |
Example
Message : | |
HOST Send | $ESP_OK|21|T|S|7|/my_test/i.txt|*4C73 |
ACK Respond | $ESP_OK|12|T|S|7|1|241|*5442 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control S_Read_Binary_data_File
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ‘8’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘8’ |
| ID Control : S_Read_Binary_data_File |
| ||||
| PL3 | STRING | - | - | 1 | 1500 | Path of file |
|
| PL4 | INTEGER | 0 | 10000000000 | - | - | Offset index start read file |
|
| PL5 | INTEGER | 1 | 1000 | - | - | Size read | byte |
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value |
|
| Describe | Unit | ||
PL2 | ‘8’ |
| ID Control : S_Read_Binary_data_File |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
[0,1000] | Size of data read respond | ||||||||
| PL4 | STRING | - | - | - | - | Data read in HEX format |
|
Example
Message : | |
HOST Send | $ESP_OK|27|T|S|8|/my_test/i.txt|0|500|*404A |
ACK Respond | $ESP_OK|493|T|S|8|241|45535072746B2056657273696F6E3A20322E372E39202E0D0A45535072746B2049443A2038313930395F4748423941202E0D0A5265636F726420696E20616374696F6E2061733A205541525420436F6E666967757265202D3E2048617264577761726520436F6E74726F6C202D3E2053442043617264202E0D0A436F6E7461637420537570706F72743A20687474703A2F2F65737072746B2E776F726470726573732E636F6D202C20456D61696C203A65737072746B40676D61696C2E636F6D202C20544D3A207068756E6774686169736F6E393640676D61696C2E636F6D202E0D0A48656C6C6F2045535072746B0D0A|*5835 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |
HOST send Control S_Append_Binary_data_to_File
<Header> + <Payload_length> | <Payload> | ||||||
PL0 | PL1 | PL2 | PL3 | PL4 | PL5 | … | |
$ESP_OK|xx| | ‘T’ | ‘S’ | ‘9’ | Infor 1 | Infor 2 | Infor 3 | ... |
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | |
PL2 | ‘9’ |
| ID Control : S_Append_Binary_data_to_File |
| ||||
| PL3 | STRING | - | - | 1 | 1500 | Path of file |
|
| PL4 | HEX | - | - | 1 | 1400 | Append data to file in HEX format |
|
ESPrtk Respond
Payload Index
| Type value | Min Value | Max Value | Min Length | Max Length | Describe | Unit | ||
PL2 | ‘9’ |
| ID Control : S_Append_Binary_data_to_File |
| |||||
| PL3 | INTEGER | -1 | 1 | - | - | Status Control |
| |
-1 | NACK: Invalid input /wrong format / out of range …? | ||||||||
0 | Error : Failed open file for append data | ||||||||
1 | OK : Append Data success | ||||||||
| PL4 | STRING | - | - | - | - | Describe status respond control as text |
|
Example
Message : | |
HOST Send | $ESP_OK|50|T|S|9|/my_test/i.txt|48656C6C6F2045535072746B0D0A|*3040 |
ACK Respond | $ESP_OK|33|T|S|9|1|File Append Data success|*1568 |
NACK Respond |
|
Other NACK | $ESP_ER|… or $ESS_ER|… or $AES_ER|… |