added transition id into block transfer module
This commit is contained in:
parent
3fe41b0f2e
commit
a1f7694bdb
|
|
@ -87,6 +87,7 @@ typedef struct
|
|||
#define MEM_OBLECT_MAX_LENGTH 32
|
||||
typedef struct
|
||||
{
|
||||
int transid;
|
||||
int opertype;
|
||||
int operphase;
|
||||
int part;
|
||||
|
|
@ -97,7 +98,7 @@ typedef struct
|
|||
struct stat file_stat;
|
||||
FILE *f;
|
||||
int open_file_timeout;
|
||||
} blockdata_transaction_t;
|
||||
} cb_blockdata_transfer_t;
|
||||
|
||||
esp_err_t start_file_server(void);
|
||||
HTTP_IO_RESULT HTTPPostApp(httpd_req_t *req, const char *filename, char *PostData);
|
||||
|
|
@ -108,7 +109,7 @@ esp_err_t download_get_handler(httpd_req_t *req);
|
|||
esp_err_t upload_post_handler(httpd_req_t *req);
|
||||
esp_err_t delete_post_handler(httpd_req_t *req);
|
||||
|
||||
esp_err_t ParseBlockDataObject(char *argres, blockdata_transaction_t *ft);
|
||||
esp_err_t ParseBlockDataObject(char *argres, cb_blockdata_transfer_t *ft);
|
||||
void FileBlockHandler(char *argres, int rw, const char* path);
|
||||
void FileListHandler(char *argres, int rw, const char* path);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@
|
|||
#define WRITE_ORERATION 3
|
||||
|
||||
|
||||
static blockdata_transaction_t FileTransaction = {
|
||||
static cb_blockdata_transfer_t FileTransaction = {
|
||||
.opertype = 0
|
||||
};
|
||||
|
||||
esp_err_t ParseBlockDataObject(char *argres, blockdata_transaction_t *ft)
|
||||
esp_err_t ParseBlockDataObject(char *argres, cb_blockdata_transfer_t *ft)
|
||||
{
|
||||
struct jReadElement result;
|
||||
jRead(argres, "", &result);
|
||||
|
|
@ -57,6 +57,13 @@ esp_err_t ParseBlockDataObject(char *argres, blockdata_transaction_t *ft)
|
|||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
jRead(argres, "{'transid'", &result);
|
||||
if (result.elements == 1)
|
||||
{
|
||||
ft->transid = atoi((char*) result.pValue);
|
||||
ESP_LOGI(TAG, "Transaction with id %d", ft->transid);
|
||||
}
|
||||
|
||||
jRead(argres, "{'opertype'", &result);
|
||||
if (result.elements == 1)
|
||||
{
|
||||
|
|
@ -226,6 +233,7 @@ void FileBlockHandler(char *argres, int rw, const char* path)
|
|||
|
||||
struct jWriteControl jwc;
|
||||
jwOpen(&jwc, argres, VAR_MAX_VALUE_LENGTH, JW_OBJECT, JW_COMPACT);
|
||||
jwObj_int(&jwc, "transid", FileTransaction.transid);
|
||||
jwObj_int(&jwc, "opertype", FileTransaction.opertype);
|
||||
jwObj_int(&jwc, "parts", FileTransaction.parts);
|
||||
jwObj_int(&jwc, "part", FileTransaction.part);
|
||||
|
|
@ -274,6 +282,7 @@ void FileBlockHandler(char *argres, int rw, const char* path)
|
|||
free(dst);
|
||||
struct jWriteControl jwc;
|
||||
jwOpen(&jwc, argres, VAR_MAX_VALUE_LENGTH, JW_OBJECT, JW_COMPACT);
|
||||
jwObj_int(&jwc, "transid", FileTransaction.transid);
|
||||
jwObj_int(&jwc, "opertype", FileTransaction.opertype);
|
||||
jwObj_int(&jwc, "parts", FileTransaction.parts);
|
||||
jwObj_int(&jwc, "part", FileTransaction.part);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user