From: SnickerSun Date: Sun, 27 Oct 2024 08:23:28 +0000 (+0800) Subject: 临时提交,功能未完善 X-Git-Url: http://git.snicker.com.cn/sitemap.xml?a=commitdiff_plain;h=d9c649a9aad1c439512af3ecfb0042e992bb934a;p=mirrors%2Ffactory_tool.git 临时提交,功能未完善 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 041dcc3..b893ae5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.5) -project(untitled LANGUAGES CXX) +project(LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -27,9 +27,9 @@ set(RC_ICONS windows.ico) find_package(Qt5 COMPONENTS Widgets LinguistTools REQUIRED) set(TS_FILES untitled_zh_CN.ts) -include_directories(${CMAKE_SOURCE_DIR}/src) +include_directories(${CMAKE_SOURCE_DIR}) if(ANDROID) - add_library(untitled SHARED + add_library(SHARED main.cpp mainwindow.cpp mainwindow.h @@ -37,7 +37,7 @@ if(ANDROID) ${TS_FILES} ) else() - add_executable(untitled + add_executable( WIN32 main.cpp mainwindow.cpp @@ -58,10 +58,10 @@ else() ) endif() -target_link_libraries(untitled PRIVATE +target_link_libraries( PRIVATE Qt5::Widgets ${CMAKE_SOURCE_DIR}/lib/libwireless_tools.dll) -target_link_libraries(untitled PRIVATE +target_link_libraries( PRIVATE Qt5::Widgets ${CMAKE_SOURCE_DIR}/lib/libsecurec.a) diff --git a/Setting.ini b/Setting.ini new file mode 100644 index 0000000..e3f6e21 --- /dev/null +++ b/Setting.ini @@ -0,0 +1,22 @@ +[Uart_setting] +uart_com=COM41 +uart_baud=18 +spp_addr= + +[Download_Setting] +download_board_path=/user/ +download_local_path= + +[Upload_Setting] +upload_board_path= +upload_local_path= + +[At_Setting] +at_mediamusicplay= +at_mediaaudiorecord= +at_fsrm= +at_delay_ms= +at_spp_addr= +custom_module_id= +custom_cmd_id= +custom_payload= diff --git a/at_data.cpp b/at_data.cpp index 993d64d..1d76e0d 100644 --- a/at_data.cpp +++ b/at_data.cpp @@ -92,15 +92,16 @@ QString At_Process::at_get_ble_format(at_mode_board mode,QString br_switch,QStri bool At_Process::at_send_cmd_board(at_mode_board mode,QString format) { - char *buf=nullptr; +// char *buf=nullptr; uint32_t buf_len=0; bool ret=false; QString str=at_get_cmd_board(mode); str+=format; str+="\r\n"; - buf = (char *)str.toStdString().c_str(); + std::string bufstr = str.toStdString(); + const char* buf = bufstr.c_str(); buf_len = strlen(buf); - if(uapi_uart_tx_data(buf, buf_len)){ + if(uapi_uart_tx_data((void*)buf, buf_len)){ ret=true; } return ret; diff --git a/debug/at_data.obj b/debug/at_data.obj new file mode 100644 index 0000000..2b32fa7 Binary files /dev/null and b/debug/at_data.obj differ diff --git a/debug/custom.obj b/debug/custom.obj new file mode 100644 index 0000000..1df2882 Binary files /dev/null and b/debug/custom.obj differ diff --git a/debug/factory_tool.exe b/debug/factory_tool.exe new file mode 100644 index 0000000..9e8ace8 Binary files /dev/null and b/debug/factory_tool.exe differ diff --git a/debug/factory_tool.ilk b/debug/factory_tool.ilk new file mode 100644 index 0000000..b647048 Binary files /dev/null and b/debug/factory_tool.ilk differ diff --git a/debug/factory_tool.pdb b/debug/factory_tool.pdb new file mode 100644 index 0000000..c21528e Binary files /dev/null and b/debug/factory_tool.pdb differ diff --git a/debug/factory_tool.vc.pdb b/debug/factory_tool.vc.pdb new file mode 100644 index 0000000..192ebff Binary files /dev/null and b/debug/factory_tool.vc.pdb differ diff --git a/debug/main.obj b/debug/main.obj new file mode 100644 index 0000000..c684f34 Binary files /dev/null and b/debug/main.obj differ diff --git a/debug/mainwindow.obj b/debug/mainwindow.obj new file mode 100644 index 0000000..3fe4735 Binary files /dev/null and b/debug/mainwindow.obj differ diff --git a/debug/moc_custom.obj b/debug/moc_custom.obj new file mode 100644 index 0000000..7bf1955 Binary files /dev/null and b/debug/moc_custom.obj differ diff --git a/debug/moc_mainwindow.obj b/debug/moc_mainwindow.obj new file mode 100644 index 0000000..a37458f Binary files /dev/null and b/debug/moc_mainwindow.obj differ diff --git a/debug/mythread.obj b/debug/mythread.obj new file mode 100644 index 0000000..74e3a86 Binary files /dev/null and b/debug/mythread.obj differ diff --git a/debug/result_thread.obj b/debug/result_thread.obj new file mode 100644 index 0000000..5cedc10 Binary files /dev/null and b/debug/result_thread.obj differ diff --git a/debug/wrtm_class.obj b/debug/wrtm_class.obj new file mode 100644 index 0000000..dd9534d Binary files /dev/null and b/debug/wrtm_class.obj differ diff --git a/factory_tool.pro b/factory_tool.pro index a3cfb75..4b23984 100644 --- a/factory_tool.pro +++ b/factory_tool.pro @@ -34,6 +34,7 @@ HEADERS += mainwindow.h \ FORMS += mainwindow.ui DISTFILES += \ + CMakeLists.txt \ readme.txt \ untitled_zh_CN.ts diff --git a/header.h b/header.h index 1e240a8..e70123a 100644 --- a/header.h +++ b/header.h @@ -34,6 +34,8 @@ uapi_errcode uapi_uart_tx_data(void *buf, uint32_t buf_len); // uart TX 发送 uapi_errcode uapi_uart_set_rts_dtr(int rts_flag, int dtr_flag); // uart 设置rts和dtr开关 uapi_errcode uapi_uart_callback_register(uart_rx_function callback); // uart 注册回调函数 uapi_errcode uapi_uart_close(void); // 关闭uart口 +uapi_errcode uapi_uart_set_currentMode(int mode); //0 SERIALPORT(单板) 1 BLUETOOTH(整机) + uapi_errcode uapi_at_send(uint8_t module_id, uint8_t cmd_id, uint8_t *pkt, uint32_t pkt_size, at_result_callback callback); // at命令发送接口,module_id及cmd_id请参考《Sparta 产线 测试指南》10.2ç«  uapi_errcode uapi_file_download(char* board_file_path, char* local_file_path, transmit_result_hook handler); // 文件下载接口,参数分别为板端文件地址(详细到文件后缀),pc端存储路径(详细到文件夹),传输结果回调函数 diff --git a/mainwindow.cpp b/mainwindow.cpp index 3b0cacc..0ccf2cf 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -209,17 +209,19 @@ void MainWindow::uart_open(QString com,QString com_baud) if(ui->stkw_stage->currentIndex() == PAGE_COMPLETE){ ui->tbw_stage_complete->setEnabled(true); ui->pbtn_spp_connect->setEnabled(true); +// uapi_uart_set_currentMode(1); }else if(ui->stkw_stage->currentIndex() == PAGE_BOARD){ ui->tbw_stage_board->setEnabled(true); +// uapi_uart_set_currentMode(0); } ui->pbtn_open_uart->setText("关闭串口"); -// ui_display("open uart success.\r\n",false); + ui_display("open uart success.\r\n",false); if(!ui->pbtn_open_uart->isChecked()){ ui->pbtn_open_uart->setChecked(true); } } else { -// ui_display("open uart fail.\r\n",false,false); + ui_display("open uart fail.\r\n",false); QMessageBox::warning(this, tr("SerialPort"), tr("Open SerialPort failed"), QMessageBox::Ok); ui->pbtn_open_uart->setChecked(false); } @@ -251,8 +253,8 @@ void MainWindow::uart_close() void MainWindow::uart_send_data() { QString str; - char *buf = nullptr; int buf_len = 0; + char* buf = nullptr; if(ui->stkw_stage->currentIndex() == PAGE_COMPLETE){ str = ui->tedit_input_data->toPlainText(); }else{ @@ -265,15 +267,20 @@ void MainWindow::uart_send_data() buf_len = hex_bytes.size(); buf = hex_bytes.data(); str=str.toUpper(); + uapi_uart_tx_data(buf, buf_len); } else { if ((ui->stkw_stage->currentIndex() == PAGE_COMPLETE &&ui->ckbox_word_wrap->isChecked())|| (ui->stkw_stage->currentIndex() ==PAGE_BOARD && ui->ckbox_word_wrap_board->isChecked())) { str+="\r\n"; } - buf = (char *)str.toStdString().c_str(); + std::string bufstr = str.toStdString(); + buf =(char*) bufstr.c_str(); buf_len = strlen(buf); + uapi_uart_tx_data(buf, buf_len); } - uapi_uart_tx_data(buf, buf_len); + + + ui_display(str,false); } @@ -407,6 +414,7 @@ void MainWindow::spp_connected_callback() } if (dongle_is_connected == true) { ui->connected_flag->setStyleSheet("QPushButton{background-color: rgb(0, 255, 64);}"); + uapi_uart_set_currentMode(1);//设置整机模式,通过蓝牙透传指令 } else { ui->connected_flag->setStyleSheet("QPushButton{background-color: rgb(255, 0, 0);}"); } @@ -535,7 +543,10 @@ void MainWindow::transmit_fromboard_getfilelist() return; } ui->cbox_fromborad_filelist->clear(); - char *buf = (char *)str.toStdString().c_str(); + + std::string bufstr = str.toStdString(); + char* buf =(char*) bufstr.c_str(); + int ret = uapi_ls_send(buf, strlen(buf), ls_callback); if (ret == FAIL) { QMessageBox::warning(this, tr("ls"), tr("ls fail!\r\n"), QMessageBox::Ok); @@ -570,8 +581,10 @@ void MainWindow::transmit_fromboard_download() } str_file_path.append(str_file_name); std::string buf_temp = str_file_path.toStdString(); +// QByteArray buf_temp = str_file_path.toUtf8() ; char *str_file_buff = (char *)buf_temp.c_str(); std::string buf_temp2 = str_savepath.toStdString(); +// QByteArray buf_temp2 = str_file_path.toUtf8(); char *str_save_buff = (char *)buf_temp2.c_str(); int ret = uapi_file_download(str_file_buff, str_save_buff, transmit_callback); if (ret == FAIL) { @@ -604,8 +617,13 @@ void MainWindow::transmit_fromboard_delete() str_file_path.append("/"); } str_file_path.append(str_file_name); - char *str_file_buff = (char *)str_file_path.toStdString().c_str(); - int ret = uapi_file_delete(str_file_buff, strlen(str_file_buff)); // ls + + std::string bufstr = str_file_path.toStdString(); + char* str_file_buff =(char*) bufstr.c_str(); + +// char *str_file_buff = (char *)str_file_path.toUtf8().data();//.toStdString().c_str(); + int buflen = strlen(str_file_buff); + int ret = uapi_file_delete(str_file_buff, buflen); // ls if (ret == FAIL) { QMessageBox::warning(this, tr("delete"), tr("delete file fail!\r\n"), QMessageBox::Ok); } @@ -640,8 +658,15 @@ void MainWindow::transmit_toboard_upload() QMessageBox::warning(this, tr("File Path"), tr("File Path Empty!"), QMessageBox::Ok); return; } - char *buf_board_file_path = (char *)board_file_path.toStdString().c_str(); - char *buf_local_file_path = (char *)local_file_path.toStdString().c_str(); + + std::string bufboard_file_path = board_file_path.toStdString(); + char* buf_board_file_path =(char*) bufboard_file_path.c_str(); + + std::string buflocal_file_path = local_file_path.toStdString(); + char* buf_local_file_path =(char*) buflocal_file_path.c_str(); + +// char *buf_board_file_path = (char *)board_file_path.toUtf8().data();//.toStdString().c_str(); +// char *buf_local_file_path = (char *)local_file_path.toUtf8().data();//.toStdString().c_str(); int ret = uapi_file_upload(buf_board_file_path, buf_local_file_path, transmit_callback); if (ret == FAIL) { QMessageBox::warning(this, tr("Upload"), tr("文件上传启动失败!\r\n"), QMessageBox::Ok); diff --git a/mainwindow.ui b/mainwindow.ui index 84ece13..0eaae6b 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -21,7 +21,7 @@ Factory_Tools - + :/icon/windows.ico:/icon/windows.ico @@ -110,7 +110,7 @@ ArrowCursor - 0 + 3 @@ -2994,9 +2994,7 @@
custom.h
- - - + pbtn_open_uart diff --git a/mythread.h b/mythread.h index 20bce24..72164a8 100644 --- a/mythread.h +++ b/mythread.h @@ -1,6 +1,6 @@ #ifndef MYTHREAD_H #define MYTHREAD_H - +#include #include #include #include @@ -27,7 +27,7 @@ class MyThread : public QThread QMutex m_lock_stop; volatile bool stopped; QMutex m_lock_Pause; - std::atomic_bool pauseFlag; + std::atomic pauseFlag; QWaitCondition condition; }; #endif // MYTHREAD_H diff --git a/readme.txt b/readme.txt index 15e8891..096c091 100644 --- a/readme.txt +++ b/readme.txt @@ -1 +1,66 @@ -本软件使用QT库进行UI界面设计。 \ No newline at end of file +main.cpp示例如下 +________________________________________________________________________________________________________________________________________ +#include +#include "interface.h" +#include "info.h" +#include "windows.h" +#include "Library_global.h" +using namespace std; + +class MyInfo : public uapi::Info +{ +public: + MyInfo(){}; + ~MyInfo(){}; + void onReadEvent(int eventType, void *data) override + { + cout<<"eventType = "<InfoEventConnect(&info); + handle->SetCurrentMode(uapi::MODE_BLUETOOTH); + +// 串口配置 + char *com = "COM11"; + handle->SerialPortOpen(com, 921600); + +// 设置为整机段 + handle->SetCurrentMode(uapi::MODE_BLUETOOTH); + +// 发送STACKINFO命令 + handle->AtMessageSend(8,0x0d,NULL,0); + +// 获取文件列表 + char ls_tx[] = "/user/"; + handle->FileGetList(ls_tx, strlen(ls_tx)); + + char board_delete_path[] = "/user/test.mp3"; + handle->FileDelete(board_delete_path, strlen(board_delete_path)); + +// 上传文件 + Sleep(1000); + char local_path[] = "C:/Users/y30032013/Desktop/music.mp3"; + char board_path[] = "/user/music.mp3"; + handle->FileUpload(board_path, local_path); + Sleep(3000); + handle->FileTransmitStop(); + +// 下载文件 + Sleep(1000); + handle->FileGetList(ls_tx, strlen(ls_tx)); + Sleep(3000); + char name[] = "/user/music.mp3"; + char pc_path[] = "C:/Users/y30032013/Desktop/bin/"; + handle->FileDownload(name, pc_path); + + while (1) { + Sleep(100); + } +} +________________________________________________________________________________________________________________________________________ diff --git a/release/at_data.obj b/release/at_data.obj new file mode 100644 index 0000000..1329fb2 Binary files /dev/null and b/release/at_data.obj differ diff --git a/release/custom.obj b/release/custom.obj new file mode 100644 index 0000000..64b0a6b Binary files /dev/null and b/release/custom.obj differ diff --git a/release/factory_tool.exe b/release/factory_tool.exe new file mode 100644 index 0000000..efac356 Binary files /dev/null and b/release/factory_tool.exe differ diff --git a/release/main.obj b/release/main.obj new file mode 100644 index 0000000..7961d78 Binary files /dev/null and b/release/main.obj differ diff --git a/release/mainwindow.obj b/release/mainwindow.obj new file mode 100644 index 0000000..b0b1b11 Binary files /dev/null and b/release/mainwindow.obj differ diff --git a/release/moc_custom.obj b/release/moc_custom.obj new file mode 100644 index 0000000..39b4657 Binary files /dev/null and b/release/moc_custom.obj differ diff --git a/release/moc_mainwindow.obj b/release/moc_mainwindow.obj new file mode 100644 index 0000000..7e546a7 Binary files /dev/null and b/release/moc_mainwindow.obj differ diff --git a/release/mythread.obj b/release/mythread.obj new file mode 100644 index 0000000..c14deb3 Binary files /dev/null and b/release/mythread.obj differ diff --git a/release/result_thread.obj b/release/result_thread.obj new file mode 100644 index 0000000..1c15396 Binary files /dev/null and b/release/result_thread.obj differ diff --git a/release/wrtm_class.obj b/release/wrtm_class.obj new file mode 100644 index 0000000..c6011e2 Binary files /dev/null and b/release/wrtm_class.obj differ diff --git a/uapi_main.h b/uapi_main.h deleted file mode 100644 index fc584ac..0000000 --- a/uapi_main.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef UAPI_MAIN_H -#define UAPI_MAIN_H - -typedef enum { - FAIL = 0x0, - SUCC = 0x1, -} uapi_errcode; - -typedef struct { - uint32_t total_size; // 当前传输文件总大小 - uint32_t transmited_size; // 当前文件已传输大小 -} uapi_transmit_progress; - -typedef struct { - uint16_t sn; // 序号 - uint8_t name_len; // 文件(夹)名长度 - uint8_t is_dir; // 是否是文件夹 - uint32_t file_size; // 文件大小 - uint8_t name[0xFF]; // 文件(夹)名 -} uapi_ls_info_t; - -typedef uint32_t (*uart_rx_function)(void *buf, uint32_t len); // uart RX 回调函数 -typedef uint32_t (*at_result_callback)(void *buf, uint32_t len); // AT 命令返回值回调函数,入参buf包括 mould_id + cmd_id + payload -typedef uint32_t (*transmit_ls_result)(uint32_t size, uapi_ls_info_t *buff); // transmit get list回调函数,入参 size 为文件(夹)的数量,buff 为文件(夹)的信息 -typedef uint32_t (*transmit_result_hook)(bool is_finished, uintptr_t usr_data); // 传输结果回调函数,is_finished 为传输结束标志,usr_data 预留接口,目前为NULL - -uapi_errcode uapi_uart_open(const char *com, uint32_t baud); // 打开uart口, com 格式为 "\\\\.\\COM47", baud 为波特率 -uapi_errcode uapi_uart_tx_data(void *buf, uint32_t buf_len); // uart TX 发送数据buf -uapi_errcode uapi_uart_set_rts_dtr(int rts_flag, int dtr_flag); // uart 设置rts和dtr开关 -uapi_errcode uapi_uart_callback_register(uart_rx_function callback); // uart 注册回调函数 -uapi_errcode uapi_uart_close(void); // 关闭uart口 - -uapi_errcode uapi_at_send(uint8_t module_id, uint8_t cmd_id, uint8_t *pkt, uint32_t pkt_size, at_result_callback callback); // at命令发送接口,module_id及cmd_id请参考《Sparta 产线 测试指南》10.2章 -uapi_errcode uapi_file_download(char* board_file_path, char* local_file_path, transmit_result_hook handler); // 文件下载接口,参数分别为板端文件地址(详细到文件后缀),pc端存储路径(详细到文件夹),传输结果回调函数 -uapi_errcode uapi_file_upload(char* board_file_path,char* local_file_path, transmit_result_hook handler); // 文件上传接口,参数分别为板端文件地址(详细到文件后缀),pc端存储路径(详细到文件后缀),传输结果回调函数 -uapi_errcode uapi_ls_send(char *path, uint32_t path_len, transmit_ls_result callback); // 查询文件列表接口,参数为板端文件路径(详细到文件夹),路径长度,get list回调函数 -uapi_errcode uapi_file_delete(char *board_file_path, uint32_t board_file_path_len); // 删除指定文件接口,参数为板端文件地址(详细到文件后缀),文件路径长度 -uapi_errcode uapi_file_transmit_stop(void); // 停止文件下载接口 -uapi_errcode uapi_transmit_process(uapi_transmit_progress *data); // 获取文件传输进度,入参 data 更新为正在传输的文件的总大小和已传输大小 -#endif diff --git a/wrtm_class.cpp b/wrtm_class.cpp index b73a591..2f23908 100644 --- a/wrtm_class.cpp +++ b/wrtm_class.cpp @@ -4,8 +4,15 @@ #include "info.h" #include "windows.h" #include "Library_global.h" +#include "qdebug.h" using namespace std; +static uart_rx_function g_uart_rx_callback=NULL; +static at_result_callback g_at_result_callback=NULL; +static transmit_ls_result g_ls_result_callback=NULL; +static transmit_result_hook g_result_hook_callback=NULL; + + class MyInfo : public uapi::Info { public: @@ -13,18 +20,36 @@ public: ~MyInfo(){}; void onReadEvent(int eventType, void *data) override { + uapi::SerialPortReceiveData *precvdata = NULL; + uapi::TransmitResult *ptransResult = NULL; + uapi::FileListResult *flistResult = NULL; + uapi::AtReceiveData *atrecvdata = NULL; + switch(eventType) { case uapi::INFO_SERIALPORT: - + precvdata=(uapi::SerialPortReceiveData*)data; + qDebug()<<"INFO_SERIALPORT "<< precvdata->data; + if(g_uart_rx_callback) + g_uart_rx_callback(precvdata->data,precvdata->dataLength); break; case uapi::INFO_FILE_TRANSMIT_RESULT: -// uapi::TransmitResult *ptransResult = (uapi::TransmitResult*)data; -// out<<"TransmitResult = "<finishResult; + ptransResult = (uapi::TransmitResult*)data; + qDebug()<<"INFO_FILE_TRANSMIT_RESULT "<< ptransResult->finishResult; + if(g_result_hook_callback) + g_result_hook_callback(ptransResult->finishResult,NULL); break; case uapi::INFO_FILE_LIST_RESULT: + flistResult=(uapi::FileListResult*)data; + qDebug()<<"INFO_FILE_LIST_RESULT "<< flistResult->lsInfo->name; + if(g_ls_result_callback) + g_ls_result_callback(flistResult->lsInfoNumber,(uapi_ls_info_t *)flistResult->lsInfo); break; case uapi::INFO_AT_RECEIVE: + atrecvdata=(uapi::AtReceiveData*)data; + qDebug()<<"INFO_AT_RECEIVE "<< atrecvdata->data; + if(g_at_result_callback) + g_at_result_callback(atrecvdata->data,atrecvdata->dataLength); break; } @@ -32,65 +57,94 @@ public: }; static MyInfo info; static Interface *handle= new Interface(); -uapi_errcode uapi_init_wrtm_class(void) +uapi_errcode uapi_uart_set_currentMode(int mode) { - handle->InfoEventConnect(&info); - handle->SetCurrentMode(uapi::MODE_BLUETOOTH); + if (mode == 0) + handle->SetCurrentMode(uapi::MODE_SERIALPORT); + else + handle->SetCurrentMode(uapi::MODE_BLUETOOTH); return SUCC; } - uapi_errcode uapi_uart_open(const char *com, uint32_t baud) // 打开uart口, com 格式为 "\\\\.\\COM47", baud 为波特率 { - return SUCC; + handle->InfoEventConnect(&info); + handle->SetCurrentMode(uapi::MODE_SERIALPORT); + int ret= handle->SerialPortOpen(com,baud); + if (ret == 0) + return SUCC; + else + return FAIL; } uapi_errcode uapi_uart_tx_data(void *buf, uint32_t buf_len) // uart TX 发送数据buf { + qDebug()<<"tx:"<SerialPortWrite((unsigned char *)buf,buf_len); return SUCC; } uapi_errcode uapi_uart_set_rts_dtr(int rts_flag, int dtr_flag) // uart 设置rts和dtr开关 { +// handle->SetCurrentMode(uapi::MODE_SERIALPORT); + handle->SerialPortSetRtsDtr(rts_flag,dtr_flag); return SUCC; } uapi_errcode uapi_uart_callback_register(uart_rx_function callback) // uart 注册回调函数 { + g_uart_rx_callback = callback; return SUCC; } uapi_errcode uapi_uart_close(void)// 关闭uart口 { + + handle->SerialPortClose(); return SUCC; } uapi_errcode uapi_at_send(uint8_t module_id, uint8_t cmd_id, uint8_t *pkt, uint32_t pkt_size, at_result_callback callback) // at命令发送接口,module_id及cmd_id请参考《Sparta 产线 测试指南》10.2章 { + g_at_result_callback = callback; + + handle->AtMessageSend(module_id,cmd_id,pkt,pkt_size); + return SUCC; } uapi_errcode uapi_file_download(char* board_file_path, char* local_file_path, transmit_result_hook handler) // 文件下载接口,参数分别为板端文件地址(详细到文件后缀),pc端存储路径(详细到文件夹),传输结果回调函数 { + g_result_hook_callback = handler; + handle->FileDownload(board_file_path,local_file_path); return SUCC; } uapi_errcode uapi_file_upload(char* board_file_path,char* local_file_path, transmit_result_hook handler)// 文件上传接口,参数分别为板端文件地址(详细到文件后缀),pc端存储路径(详细到文件后缀),传输结果回调函数 { + g_result_hook_callback = handler; + handle->FileUpload(board_file_path,local_file_path); return SUCC; } uapi_errcode uapi_ls_send(char *path, uint32_t path_len, transmit_ls_result callback)// 查询文件列表接口,参数为板端文件路径(详细到文件夹),路径长度,get list回调函数 { + g_ls_result_callback = callback; + qDebug()<<"uapi_ls_send "<FileGetList(path,path_len); + return SUCC; } uapi_errcode uapi_file_delete(char *board_file_path, uint32_t board_file_path_len) // 删除指定文件接口,参数为板端文件地址(详细到文件后缀),文件路径长度 { + handle->FileDelete(board_file_path,board_file_path_len); return SUCC; } uapi_errcode uapi_file_transmit_stop(void)// 停止文件下载接口 { + handle->FileTransmitStop(); return SUCC; } uapi_errcode uapi_transmit_process(uapi_transmit_progress *data) // 获取文件传输进度,入参 data 更新为正在传输的文件的总大小和已传输大小 { + handle->FileTransmitProgress((uapi::FileTransmitDataCount*)data); return SUCC; }