|
@@ -102,6 +102,10 @@ BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWndEx)
|
|
|
ON_COMMAND(ID_CHECK_ACTUATOR, &CMainFrame::OnCheckActuator)
|
|
|
ON_UPDATE_COMMAND_UI(ID_CHECK_ACTUATOR, &CMainFrame::OnUpdateCheckActuator)
|
|
|
ON_WM_TIMER()
|
|
|
+ ON_COMMAND(ID_COMBO_USB, &CMainFrame::OnComboUsb)
|
|
|
+ ON_UPDATE_COMMAND_UI(ID_COMBO_USB, &CMainFrame::OnUpdateComboUsb)
|
|
|
+ ON_COMMAND(ID_CHECK_USB, &CMainFrame::OnCheckUsb)
|
|
|
+ ON_UPDATE_COMMAND_UI(ID_CHECK_USB, &CMainFrame::OnUpdateCheckUsb)
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
// CMainFrame 构造/析构
|
|
@@ -125,8 +129,8 @@ CMainFrame::CMainFrame() noexcept :m_trayIcon(IDR_MAINFRAME)
|
|
|
m_bShotIR = FALSE;
|
|
|
m_pUB530View = m_pDeviceView = NULL;
|
|
|
|
|
|
- ReadBaiduCfg(m_bdcfg);
|
|
|
- ReadRsRunCfg(m_rscfg);
|
|
|
+ ReadBaiduCfg(Global::g_bdcfg);
|
|
|
+ ReadRsRunCfg(Global::g_rscfg);
|
|
|
ReadTreePath();
|
|
|
}
|
|
|
|
|
@@ -390,9 +394,9 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
|
SetWindowText(strVersionInfo);
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
- SetTimer(0, 3000, NULL);
|
|
|
+ SetTimer(0, 300000, NULL);
|
|
|
#else
|
|
|
- SetTimer(0, 60000, NULL);
|
|
|
+ SetTimer(0, 180000, NULL);
|
|
|
#endif
|
|
|
CSVNMgr::GetInstance()->Load();
|
|
|
|
|
@@ -853,7 +857,7 @@ LRESULT CMainFrame::OnRibbonChanged(WPARAM wParam, LPARAM lParam)
|
|
|
return LRESULT();
|
|
|
}
|
|
|
|
|
|
-void CMainFrame::ReadBaiduCfg(BaiduCfg& bdcfg)
|
|
|
+void CMainFrame::ReadBaiduCfg(Global::BaiduCfg& bdcfg)
|
|
|
{
|
|
|
TCHAR szValue[MAX_PATH] = { 0 };
|
|
|
TCHAR szBuffer[1024] = { 0 };
|
|
@@ -875,7 +879,7 @@ void CMainFrame::ReadBaiduCfg(BaiduCfg& bdcfg)
|
|
|
memcpy(szData, &szBuffer[j], i - j);
|
|
|
if (_tcsicmp(szData, _T("CurStatus")))
|
|
|
{
|
|
|
- CountInfo countInfo;
|
|
|
+ Global::CountInfo countInfo;
|
|
|
GetPrivateProfileString(szData, _T("APP_ID"), NULL, szValue, MAX_PATH, m_szBaiduCfgPath);
|
|
|
countInfo.app_id = szValue;
|
|
|
|
|
@@ -888,7 +892,7 @@ void CMainFrame::ReadBaiduCfg(BaiduCfg& bdcfg)
|
|
|
GetPrivateProfileString(szData, _T("Ret_Count"), NULL, szValue, MAX_PATH, m_szBaiduCfgPath);
|
|
|
countInfo.ret_count = szValue;
|
|
|
|
|
|
- bdcfg.list_count.insert(std::pair<std::string, CountInfo>(szData, countInfo));
|
|
|
+ bdcfg.list_count.insert(std::pair<std::string, Global::CountInfo>(szData, countInfo));
|
|
|
}
|
|
|
OutputDebugString(szData);
|
|
|
OutputDebugString("\n");
|
|
@@ -897,7 +901,7 @@ void CMainFrame::ReadBaiduCfg(BaiduCfg& bdcfg)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void CMainFrame::ReadRsRunCfg(RsRunCfg& rscfg)
|
|
|
+void CMainFrame::ReadRsRunCfg(Global::RsRunCfg& rscfg)
|
|
|
{
|
|
|
TCHAR szValue[MAX_PATH] = { 0 };
|
|
|
TCHAR szBuffer[1024] = { 0 };
|
|
@@ -957,7 +961,7 @@ void CMainFrame::ReadTreePath()
|
|
|
{
|
|
|
// 必须在ReadRsRunCfg之后调用;
|
|
|
TCHAR szRootDir[MAX_PATH] = { 0 };
|
|
|
- _stprintf_s(szRootDir, _T("%s%s"), m_rscfg.sat_home.c_str(), _T("resource\\MenuTree\\"));
|
|
|
+ _stprintf_s(szRootDir, _T("%s%s"), Global::g_rscfg.sat_home.c_str(), _T("resource\\MenuTree\\"));
|
|
|
|
|
|
auto _get_dir = [](std::string dir) {
|
|
|
int nIndex = dir.find_last_of('\\');
|
|
@@ -1034,9 +1038,9 @@ void CMainFrame::ReadTreePath()
|
|
|
|
|
|
void CMainFrame::ParseJson()
|
|
|
{
|
|
|
- if (m_rscfg.chroma1.size() == 0)
|
|
|
+ if (Global::g_rscfg.chroma1.size() == 0)
|
|
|
{
|
|
|
- cJSON* pJson = cJSON_Parse(m_rscfg.chroma22293.c_str());
|
|
|
+ cJSON* pJson = cJSON_Parse(Global::g_rscfg.chroma22293.c_str());
|
|
|
if (pJson)
|
|
|
{
|
|
|
cJSON* pArray = cJSON_GetObjectItem(pJson, "devices");
|
|
@@ -1049,17 +1053,17 @@ void CMainFrame::ParseJson()
|
|
|
if (pItem)
|
|
|
{
|
|
|
if (i == 0)
|
|
|
- m_rscfg.chroma1 = cJSON_GetObjectItem(pItem, "port") ? cJSON_GetObjectItem(pItem, "port")->valuestring : _T("");
|
|
|
+ Global::g_rscfg.chroma1 = cJSON_GetObjectItem(pItem, "port") ? cJSON_GetObjectItem(pItem, "port")->valuestring : _T("");
|
|
|
if (i == 1)
|
|
|
- m_rscfg.chroma2 = cJSON_GetObjectItem(pItem, "port") ? cJSON_GetObjectItem(pItem, "port")->valuestring : _T("");
|
|
|
+ Global::g_rscfg.chroma2 = cJSON_GetObjectItem(pItem, "port") ? cJSON_GetObjectItem(pItem, "port")->valuestring : _T("");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 保存;
|
|
|
- WritePrivateProfileString(_T("SATHelper"), _T("chroma1"), m_rscfg.chroma1.c_str(), m_szRsCfgPath);
|
|
|
- WritePrivateProfileString(_T("SATHelper"), _T("chroma2"), m_rscfg.chroma2.c_str(), m_szRsCfgPath);
|
|
|
+ WritePrivateProfileString(_T("SATHelper"), _T("chroma1"), Global::g_rscfg.chroma1.c_str(), m_szRsCfgPath);
|
|
|
+ WritePrivateProfileString(_T("SATHelper"), _T("chroma2"), Global::g_rscfg.chroma2.c_str(), m_szRsCfgPath);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1070,12 +1074,12 @@ void CMainFrame::RunDevice()
|
|
|
CMFCRibbonButton* pCheck1 = DYNAMIC_DOWNCAST(CMFCRibbonButton, pRibbon->FindByID(ID_CHECK1_22293));
|
|
|
CMFCRibbonButton* pCheck2 = DYNAMIC_DOWNCAST(CMFCRibbonButton, pRibbon->FindByID(ID_CHECK2_22293));
|
|
|
|
|
|
- if (m_rscfg.chroma1.size())
|
|
|
+ if (Global::g_rscfg.chroma1.size())
|
|
|
{
|
|
|
CDevice* pdev = new CDevice();
|
|
|
pdev->m_iBaudrate = 115200;
|
|
|
pdev->m_iDatabit = 8;
|
|
|
- pdev->m_iPort = atoi(m_rscfg.chroma1.substr(3).c_str());
|
|
|
+ pdev->m_iPort = atoi(Global::g_rscfg.chroma1.substr(3).c_str());
|
|
|
pdev->m_iParitybit = 0;
|
|
|
pdev->m_iStopbit = 0;
|
|
|
pdev->m_iID = 1;
|
|
@@ -1091,12 +1095,12 @@ void CMainFrame::RunDevice()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (m_rscfg.chroma2.size())
|
|
|
+ if (Global::g_rscfg.chroma2.size())
|
|
|
{
|
|
|
CDevice* pdev = new CDevice();
|
|
|
pdev->m_iBaudrate = 115200;
|
|
|
pdev->m_iDatabit = 8;
|
|
|
- pdev->m_iPort = atoi(m_rscfg.chroma2.substr(3).c_str());
|
|
|
+ pdev->m_iPort = atoi(Global::g_rscfg.chroma2.substr(3).c_str());
|
|
|
pdev->m_iParitybit = 0;
|
|
|
pdev->m_iStopbit = 0;
|
|
|
pdev->m_iID = 2;
|
|
@@ -1123,8 +1127,8 @@ void CMainFrame::InitCombobox_port()
|
|
|
CMFCRibbonComboBox* pCommbox2 = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pRibbon->FindByID(ID_COMBO2_22293));
|
|
|
CMFCRibbonComboBox* pCommboxTV = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pRibbon->FindByID(ID_COMBO_TVPORT));
|
|
|
CMFCRibbonComboBox* pCommboxTW = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pRibbon->FindByID(ID_COMBO_TWPORT));
|
|
|
- for (std::vector<std::string>::iterator it = m_vtCOM.begin(); it != m_vtCOM.end(); it++)
|
|
|
- {
|
|
|
+ CMFCRibbonComboBox* pCommboxUSB = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pRibbon->FindByID(ID_COMBO_USB));
|
|
|
+ for (std::vector<std::string>::iterator it = m_vtCOM.begin(); it != m_vtCOM.end(); it++) {
|
|
|
if (!IsPortInserted(pCommbox1, it->c_str()))
|
|
|
pCommbox1->AddItem(it->c_str());
|
|
|
|
|
@@ -1136,20 +1140,27 @@ void CMainFrame::InitCombobox_port()
|
|
|
|
|
|
if (!IsPortInserted(pCommboxTW, it->c_str()))
|
|
|
pCommboxTW->AddItem(it->c_str());
|
|
|
+
|
|
|
+ if (!IsPortInserted(pCommboxUSB, it->c_str()))
|
|
|
+ pCommboxUSB->AddItem(it->c_str());
|
|
|
}
|
|
|
|
|
|
- if (m_rscfg.chroma1.size())
|
|
|
- pCommbox1->SelectItem(m_rscfg.chroma1.c_str());
|
|
|
- if (m_rscfg.chroma2.size())
|
|
|
- pCommbox2->SelectItem(m_rscfg.chroma2.c_str());
|
|
|
- if (m_rscfg.tv_port.size())
|
|
|
- pCommboxTV->SelectItem(m_rscfg.tv_port.c_str());
|
|
|
- if (Global::g_Config.twPort)
|
|
|
- {
|
|
|
+ if (Global::g_rscfg.chroma1.size())
|
|
|
+ pCommbox1->SelectItem(Global::g_rscfg.chroma1.c_str());
|
|
|
+ if (Global::g_rscfg.chroma2.size())
|
|
|
+ pCommbox2->SelectItem(Global::g_rscfg.chroma2.c_str());
|
|
|
+ if (Global::g_rscfg.tv_port.size())
|
|
|
+ pCommboxTV->SelectItem(Global::g_rscfg.tv_port.c_str());
|
|
|
+ if (Global::g_Config.twPort) {
|
|
|
TCHAR szCom[16] = {0};
|
|
|
_stprintf_s(szCom, _T("COM%d"), Global::g_Config.twPort);
|
|
|
pCommboxTW->SelectItem(szCom);
|
|
|
}
|
|
|
+ if (Global::g_Config.usbPort) {
|
|
|
+ TCHAR szCom[16] = { 0 };
|
|
|
+ _stprintf_s(szCom, _T("COM%d"), Global::g_Config.usbPort);
|
|
|
+ pCommboxUSB->SelectItem(szCom);
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1195,27 +1206,27 @@ void CMainFrame::InitDevicePanel()
|
|
|
CMFCRibbonComboBox* pOcrCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pRibbon->FindByID(ID_COMBOX_OCR));
|
|
|
if (pOcrCombo)
|
|
|
{
|
|
|
- for (auto it : m_bdcfg.list_count)
|
|
|
+ for (auto it : Global::g_bdcfg.list_count)
|
|
|
{
|
|
|
pOcrCombo->AddItem(it.first.c_str());
|
|
|
}
|
|
|
|
|
|
// 选择默认项;
|
|
|
- pOcrCombo->SetEditText(m_bdcfg.cur_count.c_str());
|
|
|
+ pOcrCombo->SetEditText(Global::g_bdcfg.cur_count.c_str());
|
|
|
}
|
|
|
|
|
|
// 剩余次数;
|
|
|
CMFCRibbonEdit* pOcrCount = DYNAMIC_DOWNCAST(CMFCRibbonEdit, pRibbon->FindByID(ID_EDIT_COUNT));
|
|
|
if (pOcrCount)
|
|
|
{
|
|
|
- pOcrCount->SetEditText(m_bdcfg.reset_time.c_str());
|
|
|
+ pOcrCount->SetEditText(Global::g_bdcfg.reset_time.c_str());
|
|
|
}
|
|
|
|
|
|
// 声音等级;
|
|
|
CMFCRibbonEdit* pSoundLevel = DYNAMIC_DOWNCAST(CMFCRibbonEdit, pRibbon->FindByID(ID_EDIT_SOUND_LEVEL));
|
|
|
if (pSoundLevel)
|
|
|
{
|
|
|
- pSoundLevel->SetEditText(m_rscfg.sound1.c_str());
|
|
|
+ pSoundLevel->SetEditText(Global::g_rscfg.sound1.c_str());
|
|
|
}
|
|
|
|
|
|
// 全步骤截图;
|
|
@@ -1235,7 +1246,7 @@ void CMainFrame::InitDevicePanel()
|
|
|
}
|
|
|
|
|
|
// 选择默认项;
|
|
|
- pChipCombo->SetEditText(m_rscfg.menutree_chip.c_str());
|
|
|
+ pChipCombo->SetEditText(Global::g_rscfg.menutree_chip.c_str());
|
|
|
|
|
|
// UI下拉框;
|
|
|
CString curText = pChipCombo->GetEditText();
|
|
@@ -1249,15 +1260,15 @@ void CMainFrame::InitDevicePanel()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- pStyleCombo->SetEditText(m_rscfg.menutree_style.c_str());
|
|
|
+ pStyleCombo->SetEditText(Global::g_rscfg.menutree_style.c_str());
|
|
|
|
|
|
CString strCurChip = pChipCombo->GetEditText();
|
|
|
CString strCurStyle = pStyleCombo->GetEditText();
|
|
|
- _stprintf_s(m_szCurMenuTreeDir, _T("%s%s%s\\%s\\"), m_rscfg.sat_home.c_str(), _T("resource\\MenuTree\\"), strCurChip.GetString(), strCurStyle.GetString());
|
|
|
+ _stprintf_s(m_szCurMenuTreeDir, _T("%s%s%s\\%s\\"), Global::g_rscfg.sat_home.c_str(), _T("resource\\MenuTree\\"), strCurChip.GetString(), strCurStyle.GetString());
|
|
|
}
|
|
|
|
|
|
-// if (Global::g_Config.enableTW)
|
|
|
-// TW::OpenDevice(Global::g_Config.twPort, 115200, 8, 0, 0);
|
|
|
+ if (Global::g_Config.enableUSB)
|
|
|
+ TW::OpenSwitch(Global::g_Config.usbPort, 115200, 8, 0, 0);
|
|
|
|
|
|
// 启动设备;
|
|
|
Global::GetSysSerialPort(m_vtCOM);
|
|
@@ -1274,7 +1285,7 @@ void CMainFrame::OnCheckFullCut()
|
|
|
if (pFullCutCheck)
|
|
|
{
|
|
|
WritePrivateProfileString(_T("COMM"), _T("issendkeytakepicture_tester"), !pFullCutCheck->IsChecked() ? _T("True") : _T("False"), m_szRsCfgPath);
|
|
|
- m_rscfg.full_cut = !pFullCutCheck->IsChecked() ? _T("True") : _T("False");
|
|
|
+ Global::g_rscfg.full_cut = !pFullCutCheck->IsChecked() ? _T("True") : _T("False");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1282,7 +1293,7 @@ void CMainFrame::OnCheckFullCut()
|
|
|
void CMainFrame::OnUpdateCheckFullCut(CCmdUI* pCmdUI)
|
|
|
{
|
|
|
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
|
- pCmdUI->SetCheck(!_tcsicmp(m_rscfg.full_cut.c_str(), _T("True")));
|
|
|
+ pCmdUI->SetCheck(!_tcsicmp(Global::g_rscfg.full_cut.c_str(), _T("True")));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1322,13 +1333,13 @@ void CMainFrame::OnHadSound()
|
|
|
CloseHandle(sei.hProcess);
|
|
|
}
|
|
|
#endif
|
|
|
- ReadRsRunCfg(m_rscfg);
|
|
|
+ ReadRsRunCfg(Global::g_rscfg);
|
|
|
// Ribbon Combobox添加默认项;
|
|
|
CMFCRibbonBar* pRibbon = g_pMainFrame->GetRibbonBar();
|
|
|
CMFCRibbonEdit* pSoundLevel = DYNAMIC_DOWNCAST(CMFCRibbonEdit, pRibbon->FindByID(ID_EDIT_SOUND_LEVEL));
|
|
|
if (pSoundLevel)
|
|
|
{
|
|
|
- pSoundLevel->SetEditText(m_rscfg.sound1.c_str());
|
|
|
+ pSoundLevel->SetEditText(Global::g_rscfg.sound1.c_str());
|
|
|
}
|
|
|
});
|
|
|
t.detach();
|
|
@@ -1350,14 +1361,14 @@ void CMainFrame::OnDefSound()
|
|
|
_stprintf_s(m_szRsCfgPath, _T("%s%s"), Global::g_szPython27Dir, _T("Lib\\site-packages\\ssat_sdk\\config\\resource_run.cfg"));
|
|
|
WritePrivateProfileString(_T("Sound"), _T("sound_list"), _T("[2000,2000]"), m_szRsCfgPath);
|
|
|
// Ribbon Combobox添加默认项;
|
|
|
- m_rscfg.sound1 = _T("2000");
|
|
|
- m_rscfg.sound2 = _T("2000");
|
|
|
- m_rscfg.sound_list = _T("[2000,2000]");
|
|
|
+ Global::g_rscfg.sound1 = _T("2000");
|
|
|
+ Global::g_rscfg.sound2 = _T("2000");
|
|
|
+ Global::g_rscfg.sound_list = _T("[2000,2000]");
|
|
|
CMFCRibbonBar* pRibbon = g_pMainFrame->GetRibbonBar();
|
|
|
CMFCRibbonEdit* pSoundLevel = DYNAMIC_DOWNCAST(CMFCRibbonEdit, pRibbon->FindByID(ID_EDIT_SOUND_LEVEL));
|
|
|
if (pSoundLevel)
|
|
|
{
|
|
|
- pSoundLevel->SetEditText(m_rscfg.sound1.c_str());
|
|
|
+ pSoundLevel->SetEditText(Global::g_rscfg.sound1.c_str());
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1440,7 +1451,7 @@ void CMainFrame::OnComboProduct()
|
|
|
CString strSubStyle = pSubUICombo->GetEditText();
|
|
|
WritePrivateProfileString(_T("MenuTree"), _T("menutreeselectedchannel"), strSubStyle, m_szRsCfgPath);
|
|
|
|
|
|
- _stprintf_s(m_szCurMenuTreeDir, _T("%s%s%s\\%s\\"), m_rscfg.sat_home.c_str(), _T("resource\\MenuTree\\"), strCurChip.GetString(), strCurStyle.GetString());
|
|
|
+ _stprintf_s(m_szCurMenuTreeDir, _T("%s%s%s\\%s\\"), Global::g_rscfg.sat_home.c_str(), _T("resource\\MenuTree\\"), strCurChip.GetString(), strCurStyle.GetString());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1490,7 +1501,7 @@ void CMainFrame::OnComboUi()
|
|
|
CString strSubStyle = pSubUICombo->GetEditText();
|
|
|
WritePrivateProfileString(_T("MenuTree"), _T("menutreeselectedchannel"), strSubStyle, m_szRsCfgPath);
|
|
|
|
|
|
- _stprintf_s(m_szCurMenuTreeDir, _T("%s%s%s\\%s\\"), m_rscfg.sat_home.c_str(), _T("resource\\MenuTree\\"), strCurChip.GetString(), strCurStyle.GetString());
|
|
|
+ _stprintf_s(m_szCurMenuTreeDir, _T("%s%s%s\\%s\\"), Global::g_rscfg.sat_home.c_str(), _T("resource\\MenuTree\\"), strCurChip.GetString(), strCurStyle.GetString());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1533,14 +1544,14 @@ void CMainFrame::OnCombo1_22293()
|
|
|
{
|
|
|
CString strChroma1 = pCombobx1->GetEditText();
|
|
|
WritePrivateProfileString(_T("SATHelper"), _T("chroma1"), strChroma1, m_szRsCfgPath);
|
|
|
- m_rscfg.chroma1 = strChroma1.GetString();
|
|
|
+ Global::g_rscfg.chroma1 = strChroma1.GetString();
|
|
|
|
|
|
if (g_dmap.find(1) == g_dmap.end())
|
|
|
{
|
|
|
CDevice* pdev = new CDevice();
|
|
|
pdev->m_iBaudrate = 115200;
|
|
|
pdev->m_iDatabit = 8;
|
|
|
- pdev->m_iPort = atoi(m_rscfg.chroma1.substr(3).c_str());
|
|
|
+ pdev->m_iPort = atoi(Global::g_rscfg.chroma1.substr(3).c_str());
|
|
|
pdev->m_iParitybit = 0;
|
|
|
pdev->m_iStopbit = 1;
|
|
|
pdev->m_iID = 1;
|
|
@@ -1587,14 +1598,14 @@ void CMainFrame::OnCombo2_22293()
|
|
|
{
|
|
|
CString strChroma2 = pCombobx2->GetEditText();
|
|
|
WritePrivateProfileString(_T("SATHelper"), _T("chroma2"), strChroma2, m_szRsCfgPath);
|
|
|
- m_rscfg.chroma2 = strChroma2.GetString();
|
|
|
+ Global::g_rscfg.chroma2 = strChroma2.GetString();
|
|
|
|
|
|
if (g_dmap.find(2) == g_dmap.end())
|
|
|
{
|
|
|
CDevice* pdev = new CDevice();
|
|
|
pdev->m_iBaudrate = 115200;
|
|
|
pdev->m_iDatabit = 8;
|
|
|
- pdev->m_iPort = atoi(m_rscfg.chroma2.substr(3).c_str());
|
|
|
+ pdev->m_iPort = atoi(Global::g_rscfg.chroma2.substr(3).c_str());
|
|
|
pdev->m_iParitybit = 0;
|
|
|
pdev->m_iStopbit = 1;
|
|
|
pdev->m_iID = 2;
|
|
@@ -1703,7 +1714,7 @@ void CMainFrame::OnCombo2Tv()
|
|
|
{
|
|
|
CString strTVPort = pCombobxTV->GetEditText();
|
|
|
WritePrivateProfileString(_T("COMM"), _T("serial_communicator_port"), strTVPort, m_szRsCfgPath);
|
|
|
- m_rscfg.tv_port = strTVPort.GetString();
|
|
|
+ Global::g_rscfg.tv_port = strTVPort.GetString();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1720,15 +1731,15 @@ void CMainFrame::OnCheckWatchtv()
|
|
|
CMFCRibbonBar* pRibbon = g_pMainFrame->GetRibbonBar();
|
|
|
ASSERT_VALID(pRibbon);
|
|
|
CMFCRibbonButton* pCheckWatchTV = DYNAMIC_DOWNCAST(CMFCRibbonButton, pRibbon->FindByID(ID_CHECK_WATCHTV));
|
|
|
- m_rscfg.bWatchTV = !pCheckWatchTV->IsChecked();
|
|
|
- WritePrivateProfileString(_T("Abnormal"), _T("Watch"), m_rscfg.bWatchTV ? _T("1") : _T("0"), m_szRsCfgPath);
|
|
|
+ Global::g_rscfg.bWatchTV = !pCheckWatchTV->IsChecked();
|
|
|
+ WritePrivateProfileString(_T("Abnormal"), _T("Watch"), Global::g_rscfg.bWatchTV ? _T("1") : _T("0"), m_szRsCfgPath);
|
|
|
}
|
|
|
|
|
|
|
|
|
void CMainFrame::OnUpdateCheckWatchtv(CCmdUI* pCmdUI)
|
|
|
{
|
|
|
// TODO: 在此添加命令更新用户界面处理程序代码
|
|
|
- pCmdUI->SetCheck(m_rscfg.bWatchTV);
|
|
|
+ pCmdUI->SetCheck(Global::g_rscfg.bWatchTV);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1840,3 +1851,54 @@ void CMainFrame::OnTimer(UINT_PTR nIDEvent)
|
|
|
}
|
|
|
CMDIFrameWndEx::OnTimer(nIDEvent);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+void CMainFrame::OnComboUsb()
|
|
|
+{
|
|
|
+ // TODO: 在此添加命令处理程序代码
|
|
|
+ CMFCRibbonBar* pRibbon = g_pMainFrame->GetRibbonBar();
|
|
|
+ ASSERT_VALID(pRibbon);
|
|
|
+ CMFCRibbonComboBox* pCombobxUSB = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, pRibbon->FindByID(ID_COMBO_USB));
|
|
|
+
|
|
|
+ // 保存到配置文件中;
|
|
|
+ int nCurSel = pCombobxUSB->GetCurSel();
|
|
|
+ if (nCurSel != CB_ERR) {
|
|
|
+ CString strUSBPort = pCombobxUSB->GetEditText();
|
|
|
+ Global::g_Config.usbPort = _ttol(strUSBPort.Mid(3).GetString());
|
|
|
+ WritePrivateProfileString(_T("UsbSwitch"), _T("Com"), strUSBPort.Mid(3).GetString(), Global::g_szConfig);
|
|
|
+
|
|
|
+ if (Global::g_Config.enableUSB) {
|
|
|
+ TW::CloseSwitch();
|
|
|
+ TW::OpenSwitch(Global::g_Config.usbPort, 115200, 8, 0, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+void CMainFrame::OnUpdateComboUsb(CCmdUI* pCmdUI)
|
|
|
+{
|
|
|
+ // TODO: 在此添加命令更新用户界面处理程序代码
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+void CMainFrame::OnCheckUsb()
|
|
|
+{
|
|
|
+ // TODO: 在此添加命令处理程序代码
|
|
|
+ CMFCRibbonBar* pRibbon = g_pMainFrame->GetRibbonBar();
|
|
|
+ ASSERT_VALID(pRibbon);
|
|
|
+ CMFCRibbonButton* pCheckEnableUSB = DYNAMIC_DOWNCAST(CMFCRibbonButton, pRibbon->FindByID(ID_CHECK_USB));
|
|
|
+ Global::g_Config.enableUSB = !pCheckEnableUSB->IsChecked();
|
|
|
+ WritePrivateProfileString(_T("SATHelper"), _T("enableUSB"), Global::g_Config.enableUSB ? _T("1") : _T("0"), Global::g_szConfig);
|
|
|
+
|
|
|
+ if (Global::g_Config.enableUSB)
|
|
|
+ TW::OpenSwitch(Global::g_Config.usbPort, 115200, 8, 0, 0);
|
|
|
+ else
|
|
|
+ TW::CloseSwitch();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+void CMainFrame::OnUpdateCheckUsb(CCmdUI* pCmdUI)
|
|
|
+{
|
|
|
+ // TODO: 在此添加命令更新用户界面处理程序代码
|
|
|
+ pCmdUI->SetCheck(Global::g_Config.enableUSB);
|
|
|
+}
|