29 #ifndef DJI_FILE_MGR_IMPL_HPP 30 #define DJI_FILE_MGR_IMPL_HPP 33 #include <sys/types.h> 40 #include "osdk_command.h" 42 #include "commondatarangehandler.h" 43 #include "downloadbufferqueue.h" 44 #include "dji_file_mgr_define.hpp" 46 #include "mmap_file_buffer.hpp" 49 #include "commondatarangehandler.h" 50 #include "downloadbufferqueue.h" 56 typedef enum DownloadStateEnum :
int {
66 class DownloadListHandler {
68 DownloadListHandler();
69 ~DownloadListHandler();
71 CommonDataRangeHandler *range_handler_;
72 DownloadBufferQueue *download_buffer_;
73 FileMgr::FileListReqCBType reqCB;
75 std::atomic<int> downloadState;
76 std::atomic<uint32_t> updateTimeMs;
79 class DownloadDataHandler {
81 DownloadDataHandler();
82 ~DownloadDataHandler();
84 CommonDataRangeHandler *range_handler_;
85 MmapFileBuffer *mmap_file_buffer_;
86 FileMgr::FileDataReqCBType reqCB;
88 std::atomic<uint32_t> updateTimeMs;
89 std::string downloadPath;
90 std::atomic<int> downloadState;
91 std::atomic<int> curTargetFileIndex;
96 FileMgrImpl(Linker *linker, E_OSDKCommandDeiveType type, uint8_t index);
100 ErrorCode::ErrorCodeType startReqFileData(
int fileIndex, std::string localPath, FileMgr::FileDataReqCBType cb,
void* userData);
102 void HandlePushPack(dji_general_transfer_msg_ack *rsp);
112 DownloadListHandler *fileListHandler;
113 DownloadDataHandler *fileDataHandler;
116 E_OSDKCommandDeiveType type;
122 typedef struct ConsumeDataBuffer {
126 ConsumeDataBuffer ConsumeChunk(DataPointer data_pointer,
size_t &chunk_index,
size_t consumSize);
127 FilePackage parseFileList(std::list<DataPointer> fullDataList);
128 bool parseFileData(dji_general_transfer_msg_ack *rsp);
131 void OnReceiveAbortPack(dji_general_transfer_msg_ack *rsp);
132 void OnReceiveUrgePack(dji_general_transfer_msg_ack *rsp);
133 void OnReceiveDataPack(dji_general_transfer_msg_ack *rsp);
135 void fileListRawDataCB(dji_general_transfer_msg_ack *rsp);
136 void fileDataRawDataCB(dji_general_transfer_msg_ack *rsp);
138 uint16_t createNextReqSessionId() {
return reqSessionId++;};
139 uint16_t getCurReqSessionId() {
return reqSessionId;};
140 static std::atomic<uint16_t> reqSessionId;
143 static void fileListMonitorTask(
void *arg);
144 static void fileDataMonitorTask(
void *arg);
145 void printFileDownloadStatus();
153 uint64_t fdAddrIndex;
154 uint64_t tempSize = 0;
161 #endif // DJI_FILE_MGR_IMPL_HPP int64_t ErrorCodeType
Unified error type.
Definition: dji_error.hpp:144
Data struct defination for file manager.
Implementation for file manager.
handle array of characters
Definition: commondatarangehandler.h:14
All DJI OSDK OpenProtocol ACK Error Codes.