第一次提交

This commit is contained in:
2023-03-22 09:47:10 +08:00
commit f713586b04
633 changed files with 266330 additions and 0 deletions

View File

@ -0,0 +1,234 @@
#include "Widget_M300RTK.h"
int32_t ZZ_Widget_M300RTK::m_siDjiWidgetValueBtn = 0;
int32_t ZZ_Widget_M300RTK::m_siDjiWidgetValueList_CaptureMode = 1;
int32_t ZZ_Widget_M300RTK::m_siDjiWidgetValueList_DecisionHeight = 1;
int32_t ZZ_Widget_M300RTK::m_siDjiWidgetValueList_SamplingRate = 0;
ZZ_Widget_M300RTK::ZZ_Widget_M300RTK(QObject* parent /*= nullptr*/)
{
m_iFlagIsVehicleCapturing = 0;
connect(this,&ZZ_Widget_M300RTK::Signal_UpdatePSDKFloatMessage,this,&ZZ_Widget_M300RTK::Slot_UpdatePSDKFloatMessage);
}
ZZ_Widget_M300RTK::~ZZ_Widget_M300RTK()
{
}
int ZZ_Widget_M300RTK::InitParam()
{
return 0;
}
int ZZ_Widget_M300RTK::SetUIFilePath(char* pcUIFilePath, uint16_t uiLength)
{
if (uiLength>=256)
{
qDebug() << "ZZ_Widget_M300RTK: Func SetUIFilePath. File path is too long";
return 1;
}
QByteArray qbaTemp(pcUIFilePath);
m_qstrFilePath = qbaTemp;
return 0;
}
int ZZ_Widget_M300RTK::UpdateCaptureStatus(int iStatus)
{
m_iFlagIsVehicleCapturing = iStatus;
}
int ZZ_Widget_M300RTK::GetSettings(UIConfig &struUIConfig)
{
struUIConfig.sDecisionHeight = m_siDjiWidgetValueList_DecisionHeight;
struUIConfig.sCaptureMode = m_siDjiWidgetValueList_CaptureMode;
struUIConfig.sSamplingRate = m_siDjiWidgetValueList_SamplingRate;
return 0;
}
int ZZ_Widget_M300RTK::SetSettings(UIConfig struUIConfig)
{
m_struUIConfig = struUIConfig;
m_siDjiWidgetValueList_CaptureMode = struUIConfig.sCaptureMode;
m_siDjiWidgetValueList_DecisionHeight = struUIConfig.sDecisionHeight;
m_siDjiWidgetValueList_SamplingRate = struUIConfig.sSamplingRate;
return 0;
}
int ZZ_Widget_M300RTK::PreparteEnvironment()
{
T_DjiReturnCode djiStat;
static const T_DjiWidgetHandlerListItem s_DjiWidgetHandlerList[] =
{
{0, DJI_WIDGET_TYPE_SWITCH, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
{1, DJI_WIDGET_TYPE_LIST, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
{2, DJI_WIDGET_TYPE_LIST, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this},
{3, DJI_WIDGET_TYPE_LIST, ZZ_Widget_M300RTK::OnUpdateWidgetValue, ZZ_Widget_M300RTK::OnLoadWidgetValue, this}
};
djiStat = DjiWidget_Init();
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
qDebug() << "ZZ_Widget_M300RTK: Func DjiWidget_Init. Dji widget init error"<< djiStat;
//return djiStat;
}
djiStat = DjiWidget_RegDefaultUiConfigByDirPath(m_qstrFilePath.toLatin1());
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
qDebug() << m_qstrFilePath.toLatin1();
qDebug() << "ZZ_Widget_M300RTK: Func DjiWidget_RegDefaultUiConfigByDirPath.Add default widget ui config error";
return djiStat;
}
djiStat = DjiWidget_RegHandlerList(s_DjiWidgetHandlerList, sizeof(s_DjiWidgetHandlerList) / sizeof(T_DjiWidgetHandlerListItem));
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
qDebug() <<"ZZ_Widget_M300RTK: Func DjiWidget_RegHandlerList.Set widget handler list error";
return djiStat;
}
return 0;
}
int ZZ_Widget_M300RTK::UploadResources()
{
return 0;
}
int ZZ_Widget_M300RTK::test_UpdatePSDKFloatMessage(QString qstrMessage)
{
T_DjiReturnCode djiStat;
djiStat = DjiWidgetFloatingWindow_ShowMessage(qstrMessage.toLatin1());
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
qDebug() << "ZZ_Widget_M300RTK: Func test_UpdatePSDKFloatMessage.Floating window show message error";
}
return 0;
}
T_DjiReturnCode ZZ_Widget_M300RTK::OnUpdateWidgetValue(E_DjiWidgetType widgetType, uint32_t index, int32_t value, void* userData)
{
ZZ_Widget_M300RTK* pCaller = (ZZ_Widget_M300RTK*)userData;
if (pCaller->m_iFlagIsVehicleCapturing)
{
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
}
if (widgetType == DJI_WIDGET_TYPE_SWITCH )
{
if (ZZ_Widget_M300RTK::m_siDjiWidgetValueList_CaptureMode==0)
{
pCaller->emit Signal_UpdatePSDKFloatMessage("Automatic capture mode.Please don't use this function");
return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
}
else
{
if (value==1)
{
pCaller->emit Signal_UpdatePSDKFloatMessage("start capture");
pCaller->emit Signal_StartCapture();
}
else
{
pCaller->emit Signal_UpdatePSDKFloatMessage("capture stopped");
pCaller->emit Signal_StopCapture();
}
}
ZZ_Widget_M300RTK::m_siDjiWidgetValueBtn = value;
///for test
QString qstrTest;
qDebug() << "OnUpdateWidgetValue " << "widgetType " << widgetType << "index " << index << "value " << value;
qstrTest = QString("index:%1,value:%2").arg(index, value);
//pCaller->test_UpdatePSDKFloatMessage(qstrTest);
//qstrTest = "12345";
//pCaller->emit Signal_UpdatePSDKFloatMessage(qstrTest);
}
if (widgetType == DJI_WIDGET_TYPE_LIST )
{
if (index==1)
{
pCaller->emit Signal_UpdateCaptureMode((char)value);
ZZ_Widget_M300RTK::m_siDjiWidgetValueList_CaptureMode = value;
}
else if (index == 2)
{
ZZ_Widget_M300RTK::m_siDjiWidgetValueList_DecisionHeight = value;
}
else if (index == 3)
{
ZZ_Widget_M300RTK::m_siDjiWidgetValueList_SamplingRate = value;
}
#ifdef ZZ_FLAG_TEST
qDebug() << "OnUpdateWidgetValue " << "widgetType " << widgetType << "index " << index << "value " << value;
#endif
}
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
T_DjiReturnCode ZZ_Widget_M300RTK::OnLoadWidgetValue(E_DjiWidgetType widgetType, uint32_t index, int32_t* value, void* userData)
{
if (widgetType == DJI_WIDGET_TYPE_SWITCH)
{
//qDebug() << "OnLoadWidgetValue " << "widgetType " << widgetType << "index " << index << "value " << value;
*value= ZZ_Widget_M300RTK::m_siDjiWidgetValueBtn;
}
if (widgetType == DJI_WIDGET_TYPE_LIST)
{
//qDebug() << "OnLoadWidgetValue " << "widgetType " << widgetType << "index " << index << "value " << value;
if (index == 1)
{
*value = ZZ_Widget_M300RTK::m_siDjiWidgetValueList_CaptureMode;
}
else if (index == 2)
{
*value = ZZ_Widget_M300RTK::m_siDjiWidgetValueList_DecisionHeight;
}
else if (index == 3)
{
*value = ZZ_Widget_M300RTK::m_siDjiWidgetValueList_SamplingRate;
}
}
return DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS;
}
int ZZ_Widget_M300RTK::Slot_UpdatePSDKFloatMessage(QString qstrMessage)
{
T_DjiReturnCode djiStat;
djiStat = DjiWidgetFloatingWindow_ShowMessage(qstrMessage.toLatin1());
if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
{
qDebug() << "ZZ_Widget_M300RTK: Func test_UpdatePSDKFloatMessage.Floating window show message error";
}
return 0;
}

View File

@ -0,0 +1,50 @@
#pragma once
#include <iostream>
#include <fstream>
#include "dji_typedef.h"
#include "dji_core.h"
#include "pch.h"
#include "dji_widget.h"
#include "ConfigParser_M300RTK.h"
using namespace std;
class ZZ_Widget_M300RTK :public QObject
{
Q_OBJECT
public:
ZZ_Widget_M300RTK(QObject* parent = nullptr);
virtual ~ZZ_Widget_M300RTK();
public:
private:
int m_iFlagIsVehicleCapturing;
UIConfig m_struUIConfig;
short m_sFlagCaptureMode;
QString m_qstrFilePath;
static int32_t m_siDjiWidgetValueBtn, m_siDjiWidgetValueList_CaptureMode, m_siDjiWidgetValueList_SamplingRate, m_siDjiWidgetValueList_DecisionHeight;
public:
int PreparteEnvironment();
int SetUIFilePath(char* pcUIFilePath, uint16_t uiLength);
int UpdateCaptureStatus(int iStatus);
int GetSettings(UIConfig &struUIConfig);
int SetSettings(UIConfig struUIConfig);
//int UpdateCaptureStatus(int iStatus);
private:
int InitParam();
int UploadResources();
int test_UpdatePSDKFloatMessage(QString qstrMessage);
public:
static T_DjiReturnCode OnUpdateWidgetValue(E_DjiWidgetType widgetType, uint32_t index, int32_t value,void* userData);
static T_DjiReturnCode OnLoadWidgetValue (E_DjiWidgetType widgetType, uint32_t index, int32_t* value,void* userData);
public slots:
int Slot_UpdatePSDKFloatMessage(QString qstrMessage);
signals:
void Signal_UpdatePSDKFloatMessage(QString qstrMessage);
///0:Auto 1:Manual
void Signal_UpdateCaptureMode(char cMode);
void Signal_StartCapture();
void Signal_StopCapture();
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,52 @@
{
"version":
{
"major": 1,
"minor": 0
},
"main_interface": {
"floating_window": {
"is_enable": true
},
"speaker": {
"is_enable_tts": false,
"is_enable_voice": false
},
"widget_list": [
{
}
]
},
"config_interface":
{
"widget_list":
[
{
"widget_index": 1,
"widget_type": "list",
"widget_name": "采集模式",
"list_item": [
{
"item_name": "自动航线采集",
"icon_file_set": {
"icon_file_name_selected": "",
"icon_file_name_unselected": ""
}
},
{
"item_name": "手动航线采集",
"icon_file_set": {
"icon_file_name_selected": "",
"icon_file_name_unselected": ""
}
}
],
"customize_rc_buttons_config": {
"is_enable": true,
"mapping_config_display_order": 1
}
}
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,109 @@
{
"version":
{
"major": 1,
"minor": 0
},
"main_interface": {
"floating_window": {
"is_enable": true
},
"speaker": {
"is_enable_tts": false,
"is_enable_voice": false
},
"widget_list": [
{
"widget_index": 0,
"widget_type": "switch",
"widget_name": "采集",
"icon_file_set": {
"icon_file_name_selected": "icon_button_zz_stop.png",
"icon_file_name_unselected": "icon_button_zz_start.png"
},
"customize_rc_buttons_config": {
"is_enable": true,
"mapping_config_display_order": 3,
"button_value_step_length": 5
}
}
]
},
"config_interface":
{
"widget_list":
[
{
"widget_index": 1,
"widget_type": "list",
"widget_name": "采集模式",
"list_item": [
{
"item_name": "自动航线采集",
"icon_file_set": {
"icon_file_name_selected": "",
"icon_file_name_unselected": ""
}
},
{
"item_name": "手动航线采集",
"icon_file_set": {
"icon_file_name_selected": "",
"icon_file_name_unselected": ""
}
}
],
"customize_rc_buttons_config": {
"is_enable": true,
"mapping_config_display_order": 1
}
},
{
"widget_index": 2,
"widget_type": "list",
"widget_name": "决断高度",
"list_item": [
{
"item_name": "0m"
},
{
"item_name": "10m"
},
{
"item_name": "20m"
},
{
"item_name": "∞"
}
],
"customize_rc_buttons_config": {
"is_enable": true,
"mapping_config_display_order": 2
}
},
{
"widget_index": 3,
"widget_type": "list",
"widget_name": "采样频率",
"list_item": [
{
"item_name": "1Hz"
},
{
"item_name": "2Hz"
},
{
"item_name": "5Hz"
},
{
"item_name": "10Hz"
}
],
"customize_rc_buttons_config": {
"is_enable": true,
"mapping_config_display_order": 3
}
}
]
}
}