1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123 |
- // DialogADCalibrationMain.cpp : 实现文件
- //
- #include "stdafx.h"
- #include "DIOS_3DDR_MechCal.h"
- #include "DialogADCalibrationMain.h"
- #include "afxdialogex.h"
- #include "DialogPhysicalInput.h"
- static vector<CString> SplitCString(CString strSource, CString ch)
- {
- vector<CString> vecString;
- int iPos = 0;
- CString strTmp;
- strTmp = strSource.Tokenize(ch, iPos);
- while (strTmp.Trim() != _T(""))
- {
- vecString.push_back(strTmp);
- strTmp = strSource.Tokenize(ch, iPos);
- }
- return vecString;
- }
- // CDialogADCalibrationMain 对话框
- IMPLEMENT_DYNAMIC(CDialogADCalibrationMain, CDialogEx)
- CDialogADCalibrationMain::CDialogADCalibrationMain(CWnd* pParent /*=NULL*/)
- : CDialogEx(CDialogADCalibrationMain::IDD, pParent)
- {
- }
- CDialogADCalibrationMain::~CDialogADCalibrationMain()
- {
- }
- void CDialogADCalibrationMain::DoDataExchange(CDataExchange* pDX)
- {
- CDialogEx::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_COMBO_ROTATE_DIRECTION, m_rotateDirection);
- DDX_Control(pDX, IDC_EDIT_ROTATE_TUBE_ANGLE_STEP, m_rotateStep);
- DDX_Control(pDX, IDC_COMBO_MOVE_DIRECTION, m_tubeHeightDirection);
- DDX_Control(pDX, IDC_EDIT_MOVE_TUBE_HEIGHT_STEP, m_tubeHeightStep);
- DDX_Control(pDX, IDC_EDIT_AD_VALUE_TUBE_ANGLE, m_tubeAngleAD);
- DDX_Control(pDX, IDC_EDIT_TUBE_ANGLE_ADS, m_tubeAngleCalADs);
- DDX_Control(pDX, IDC_EDIT_TUBE_ANGLE_PHYSICALS, m_tubeAngleCalPhysicals);
- DDX_Control(pDX, IDC_EDIT_AD_VALUE_TUBE_HEIGHT, m_tubeHeightAD);
- DDX_Control(pDX, IDC_EDIT_TUBE_HEIGHT_ADS, m_tubHeightCalADs);
- DDX_Control(pDX, IDC_EDIT_TUBE_HEIGHT_PHYSICALS, m_tubeHeightCalPhysicals);
- DDX_Control(pDX, IDC_EDIT_AD_VALUE_DET_HEIGHT, m_detectorAD);
- DDX_Control(pDX, IDC_EDIT_DET_HEIGHT_ADS, m_detectorCalAds);
- DDX_Control(pDX, IDC_EDIT_DET_HEIGHT_PHYSICALS, m_detectorHeightCalPhysicals);
- DDX_Control(pDX, IDC_EDIT_ENCODER_VALUE_TUBE_ANGLE, m_tubeAngleEncoder);
- DDX_Control(pDX, IDC_EDIT_ENCODER_VALUE_TUBE_HEIGHT, m_tubeHeightEncoder);
- DDX_Control(pDX, IDC_EDIT_PCODE, m_pcode);
- DDX_Control(pDX, IDC_COMBO_EX_MODE, m_examMode);
- DDX_Control(pDX, IDC_EDIT_C_TUBE_ANGLE, m_autoadTubeAngleCurrent);
- DDX_Control(pDX, IDC_EDIT_H_TUBE_ANGLE, m_autoadTubeAngleHighlimit);
- DDX_Control(pDX, IDC_EDIT_L_TUBEANGLE, m_autoadTubeAngleLowlimit);
- DDX_Control(pDX, IDC_EDIT_C_TUBE_HEIGHT, m_autoadTubeHeightCurrent);
- DDX_Control(pDX, IDC_EDIT_H_TUBE_HEIGHT, m_autoadTubeHeightHighlimit);
- DDX_Control(pDX, IDC_EDIT_L_TUBEHEIGHT, m_autoadTubeHeightLowlimit);
- DDX_Control(pDX, IDC_COMBO_SELFT_DOF, m_selftestDOF);
- DDX_Control(pDX, IDC_EDIT_SELFT_HIGH_LIMIT, m_selftestHighlimit);
- DDX_Control(pDX, IDC_EDIT_SELFT_LOW_LIMIT, m_selftestlowlimit);
- DDX_Control(pDX, IDC_EDIT_SELFT_PERIOD, m_selftestperiod);
- DDX_Control(pDX, IDC_EDIT_SELFT_DUTYCYCLE, m_selftestdutycycle);
- DDX_Control(pDX, IDC_EDIT2, m_selftestRepeatTime);
- }
- BEGIN_MESSAGE_MAP(CDialogADCalibrationMain, CDialogEx)
- ON_BN_CLICKED(IDC_BUTTON_ROTATE_TUBE_ANGLE, &CDialogADCalibrationMain::OnBnClickedButtonRotateTubeAngle)
- ON_BN_CLICKED(IDC_BUTTON_MOVE_TUBE_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonMoveTubeHeight)
- ON_BN_CLICKED(IDC_BUTTON_READ_AD_TUBE_ANGLE, &CDialogADCalibrationMain::OnBnClickedButtonReadAdTubeAngle)
- ON_BN_CLICKED(IDC_BUTTON_READ_AD_TUBE_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonReadAdTubeHeight)
- ON_BN_CLICKED(IDC_BUTTON_READ_AD_DET_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonReadAdDetHeight)
- ON_BN_CLICKED(IDC_BUTTON_CAL_TUBE_ANGLE_AD, &CDialogADCalibrationMain::OnBnClickedButtonCalTubeAngleAd)
- ON_BN_CLICKED(IDC_BUTTON_CAL_TUBE_HEIGHT_AD, &CDialogADCalibrationMain::OnBnClickedButtonCalTubeHeightAd)
- ON_BN_CLICKED(IDC_BUTTON_CAL_DET_HEIGHT_AD, &CDialogADCalibrationMain::OnBnClickedButtonCalDetHeightAd)
- ON_WM_CLOSE()
- ON_BN_CLICKED(IDC_BUTTON_READ_ENCODER_TUBE_ANGLE, &CDialogADCalibrationMain::OnBnClickedButtonReadEncoderTubeAngle)
- ON_BN_CLICKED(IDC_BUTTON_READ_ENCODER_TUBE_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonReadEncoderTubeHeight)
- ON_BN_CLICKED(IDC_BUTTON_ENTER_CALIBRATION, &CDialogADCalibrationMain::OnBnClickedButtonEnterCalibration)
- ON_BN_CLICKED(IDC_BUTTON_EXIT_CALIBRATION, &CDialogADCalibrationMain::OnBnClickedButtonExitCalibration)
- ON_BN_CLICKED(IDC_BUTTON_RESET_SYSTEM, &CDialogADCalibrationMain::OnBnClickedButtonResetSystem)
- ON_BN_CLICKED(ID_BUTTON_CENTERADJUST, &CDialogADCalibrationMain::OnBnClickedButtonCenteradjust)
- ON_BN_CLICKED(ID_BUTTON_PARKING, &CDialogADCalibrationMain::OnBnClickedButtonParking)
- ON_BN_CLICKED(ID_BUTTON_TUBE_ANGLE_LOW_LIMIT, &CDialogADCalibrationMain::OnBnClickedButtonTubeAngleLowLimit)
- ON_BN_CLICKED(ID_BUTTON_TUBE_HEIGHT_LOW_LIMIT, &CDialogADCalibrationMain::OnBnClickedButtonTubeHeightLowLimit)
- ON_BN_CLICKED(IDC_BUTTON_ENTER_SELFTEST, &CDialogADCalibrationMain::OnBnClickedButtonEnterSelftest)
- ON_BN_CLICKED(IDC_BUTTON_EXIT_SELFTEST, &CDialogADCalibrationMain::OnBnClickedButtonExitSelftest)
- ON_BN_CLICKED(IDC_BUTTON_START_SELFTEST, &CDialogADCalibrationMain::OnBnClickedButtonStartSelftest)
- ON_BN_CLICKED(IDC_BUTTON_ACTIVE_TUBE_ANGLE_Z_CLEAR, &CDialogADCalibrationMain::OnBnClickedButtonActiveTubeAngleZClear)
- ON_BN_CLICKED(IDC_BUTTON_CANCEL_TUBE_ANGLE_Z_CLEAR, &CDialogADCalibrationMain::OnBnClickedButtonCancelTubeAngleZClear)
- ON_BN_CLICKED(IDC_BUTTON_ACTIVE_TUBE_HEIGHT_Z_CLEAR, &CDialogADCalibrationMain::OnBnClickedButtonActiveTubeHeightZClear)
- ON_BN_CLICKED(IDC_BUTTON_CANCEL_TUBE_HEIGHT_Z_CLEAR, &CDialogADCalibrationMain::OnBnClickedButtonCancelTubeHeightZClear)
- ON_BN_CLICKED(IDC_BUTTON_ROTATE_TO_TUBE_ANGLE_Z_AXIS, &CDialogADCalibrationMain::OnBnClickedButtonRotateToTubeAngleZAxis)
- ON_BN_CLICKED(IDC_BUTTON_MOVE_TO_TUBE_HEIGHT_Z_AXIS, &CDialogADCalibrationMain::OnBnClickedButtonMoveToTubeHeightZAxis)
- ON_BN_CLICKED(IDC_BUTTON_EM_STOP, &CDialogADCalibrationMain::OnBnClickedButtonEmStop)
- ON_BN_CLICKED(IDC_BUTTON_SET_PCODE_PARAM, &CDialogADCalibrationMain::OnBnClickedButtonSetPcodeParam)
- ON_BN_CLICKED(IDC_BUTTON_ROTATE_TUBE_ANGLE_PHY, &CDialogADCalibrationMain::OnBnClickedButtonRotateTubeAnglePhy)
- ON_BN_CLICKED(IDC_BUTTON_MOVE_TUBE_HEIGHT_PHY, &CDialogADCalibrationMain::OnBnClickedButtonMoveTubeHeightPhy)
- ON_BN_CLICKED(IDC_BUTTON_INSERT_TUBE_ANGLE, &CDialogADCalibrationMain::OnBnClickedButtonInsertTubeAngle)
- ON_BN_CLICKED(IDC_BUTTON_INSERT_TUBE_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonInsertTubeHeight)
- ON_BN_CLICKED(IDC_BUTTON_INSERT_Detector_HEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonInsertDetectorHeight)
- ON_BN_CLICKED(IDC_BUTTON_AUTO_CALAD_TUBEANGLE, &CDialogADCalibrationMain::OnBnClickedButtonAutoCaladTubeangle)
- ON_BN_CLICKED(IDC_BUTTON_AUTO_CALAD_TUBEHEIGHT, &CDialogADCalibrationMain::OnBnClickedButtonAutoCaladTubeheight)
- ON_BN_CLICKED(IDC_TUBE_ANGLE_SVO, &CDialogADCalibrationMain::OnBnClickedTubeAngleSvo)
- ON_BN_CLICKED(IDC_BUTTON_TUBEHEIGHT_SVO, &CDialogADCalibrationMain::OnBnClickedButtonTubeheightSvo)
- END_MESSAGE_MAP()
- // CDialogADCalibrationMain 消息处理程序
- void CDialogADCalibrationMain::OnBnClickedButtonRotateTubeAngle()
- {
- auto direction = m_rotateDirection.GetCurSel();
- CString strSteps;
- m_rotateStep.GetWindowText(strSteps);
- auto steps = atoi(strSteps.GetString());
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("Orientation", direction);
- oTemp.add("StepNumber", steps);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("CalMotionTubeAngleRotate", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonMoveTubeHeight()
- {
- auto direction = m_tubeHeightDirection.GetCurSel();
- CString strSteps;
- m_tubeHeightStep.GetWindowText(strSteps);
- auto steps = atoi(strSteps.GetString());
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("Orientation", direction);
- oTemp.add("StepNumber", steps);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("CalMotionTubeLineV", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonReadAdTubeAngle()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("CalGetADofTubeAngle", Request, Result, 3000) == RET_SUCCEED)
- {
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADTubeAngle"]);
- m_tubeAngleAD.SetWindowText(strText);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonReadAdTubeHeight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("CalGetADofTubeLineV", Request, Result, 30000) == RET_SUCCEED)
- {
- string str = Result.encode();
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADTubeHeight"]);
- m_tubeHeightAD.SetWindowText(strText);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonReadAdDetHeight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("CalGetADofDetector", Request, Result, 3000) == RET_SUCCEED)
- {
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADDetectorHeight"]);
- m_detectorAD.SetWindowText(strText);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonReadEncoderTubeAngle()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("CalGetEncoderOfTubeAngle", Request, Result, 3000) == RET_SUCCEED)
- {
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["EncoderTubeAngle"]);
- m_tubeAngleEncoder.SetWindowText(strText);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonReadEncoderTubeHeight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("CalGetEncoderofTubeLineV", Request, Result, 30000) == RET_SUCCEED)
- {
- string str = Result.encode();
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["EncoderTubeHeight"]);
- m_tubeHeightEncoder.SetWindowText(strText);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCalTubeAngleAd()
- {
- ResDataObject Request;
- ResDataObject Result;
- CString physicals;
- CString ads;
- ResDataObject params;
- m_tubeAngleCalPhysicals.GetWindowText(physicals);
- m_tubeAngleCalADs.GetWindowText(ads);
- auto vphs = SplitCString(physicals, "#");
- for (int i = 0; i < vphs.size();++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "Physical%d", i);
- params.add(tmp, vphs[i].GetString());
- }
- auto vads = SplitCString(ads,"#");
- for (int i = 0; i < vads.size();++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "AD%d", i);
- params.add(tmp, vads[i].GetString());
- }
- params.add("PointCount", (int)vphs.size());
- Request.add("P0", params);
- if (g_DiosAPIServer.ExecuteAction("CalSaveParamsofTubeAngle", Request, Result, 30000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCalTubeHeightAd()
- {
- ResDataObject Request;
- ResDataObject Result;
- CString physicals;
- CString ads;
- ResDataObject params;
- m_tubeHeightCalPhysicals.GetWindowText(physicals);
- m_tubHeightCalADs.GetWindowText(ads);
- auto vphs = SplitCString(physicals, "#");
- for (int i = 0; i < vphs.size(); ++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "Physical%d", i);
- params.add(tmp, vphs[i].GetString());
- }
- auto vads = SplitCString(ads, "#");
- for (int i = 0; i < vads.size(); ++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "AD%d", i);
- params.add(tmp, vads[i].GetString());
- }
- params.add("PointCount", (int)vphs.size());
- Request.add("P0", params);
- if (g_DiosAPIServer.ExecuteAction("CalSaveParamsofTubeLiveV", Request, Result, 30000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCalDetHeightAd()
- {
- ResDataObject Request;
- ResDataObject Result;
- CString physicals;
- CString ads;
- ResDataObject params;
- m_detectorHeightCalPhysicals.GetWindowText(physicals);
- m_detectorCalAds.GetWindowText(ads);
- auto vphs = SplitCString(physicals, "#");
- for (int i = 0; i < vphs.size(); ++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "Physical%d", i);
- params.add(tmp, vphs[i].GetString());
- }
- auto vads = SplitCString(ads, "#");
- for (int i = 0; i < vads.size(); ++i)
- {
- char tmp[64] = { 0 };
- sprintf_s(tmp, "AD%d", i);
- params.add(tmp, vads[i].GetString());
- }
- params.add("PointCount", (int)vphs.size());
- Request.add("P0", params);
- if (g_DiosAPIServer.ExecuteAction("CalSaveParamsofDetector", Request, Result, 30000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonEnterCalibration()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("EnterCalibration", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonExitCalibration()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("ExitCalibration", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonResetSystem()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("RESET", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCenteradjust()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("ParkingMode", 0);
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("ParkingTo", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonParking()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("ParkingMode", 1);
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("ParkingTo", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonTubeAngleLowLimit()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("ParkingMode", 2);
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("ParkingTo", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonTubeHeightLowLimit()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("ParkingMode", 3);
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("ParkingTo", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonEnterSelftest()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("EnterMechnicalSelfTest", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonExitSelftest()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("ExitMechnicalSelfTest", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonStartSelftest()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString highlimit, lowlimit, period, dutyCycle,repeatTime;
- m_selftestHighlimit.GetWindowText(highlimit);
- m_selftestlowlimit.GetWindowText(lowlimit);
- m_selftestperiod.GetWindowText(period);
- m_selftestdutycycle.GetWindowText(dutyCycle);
- m_selftestRepeatTime.GetWindowText(repeatTime);
- oTemp.add("DOF", m_selftestDOF.GetCurSel());
- oTemp.add("HighLimit", highlimit.GetString());
- oTemp.add("LowLimit", lowlimit.GetString());
- oTemp.add("Period", atoi(period.GetString()));
- oTemp.add("DutyCycle", dutyCycle.GetString());
- oTemp.add("RepeatTime", atoi(repeatTime.GetString()));
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("StartMechnicalSelfTest", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonActiveTubeAngleZClear()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("ActiveTubeAngleZAxisClear", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCancelTubeAngleZClear()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("CancelTubeAngleZAxisClear", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonActiveTubeHeightZClear()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("ActiveTubeHeightZAxisClear", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonCancelTubeHeightZClear()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("CancelTubeHeightZAxisClear", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonRotateToTubeAngleZAxis()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("TubeAngleRotateToZAxis", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonMoveToTubeHeightZAxis()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("TubeHeightMoveToZAxis", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonEmStop()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("ForceStopAllMotion", Request, Result, 3000) == RET_SUCCEED)
- {
- }
- }
- void CDialogADCalibrationMain::SetExamMode(int mode)
- {
- ResDataObject Request;
- ResDataObject Result;
- ResDataObject ExamDR;
- ResDataObject ExamTomo;
- ResDataObject ExamCBCT;
- //"RF":"Tomo" : "1"
- ResDataObject ExamInfo;
- ExamDR.add("Single", "1");
- ExamTomo.add("TOMO", "1");
- ExamCBCT.add("CBCT","1");
- if (mode == 0)
- {
- ExamInfo.add("DX", ExamDR);
- }
- else if (mode == 1)
- {
- ExamInfo.add("DX", ExamTomo);
- }
- else if (mode == 2)
- {
- ExamInfo.add("DX", ExamCBCT);
- }
- Request.add("P0", ExamInfo);
- if (g_DiosAPIServer.ExecuteAction("SetExamInfo", Request, Result, 30000))
- {
- printf("SetExamInfo Action Failed\n");
- }
- else
- {
- printf("SetExamInfo Action Succeed\n");
- }
- Request.clear(); Result.clear();
- Request.add("P0", "DX");
- if (g_DiosAPIServer.ExecuteAction("SelectExamMode", Request, Result, 30000) < RET_SUCCEED)
- {
- printf("SelectExamMode Action Failed\n");
- }
- else
- {
- printf("SelectExamMode Action Succeed\n");
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonSetPcodeParam()
- {
- int nCurSel = 1;
- nCurSel = m_examMode.GetCurSel();
- if (nCurSel < 0)
- {
- nCurSel = 1;
- }
- SetExamMode(nCurSel);
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString strPositionCode;
- m_pcode.GetWindowText(strPositionCode);
- oTemp.add("SID", "1.20");
- oTemp.add("PositionNumber", strPositionCode);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("SetTechParamsInfo", Request, Result, 30000);
- Request.clear(); Result.clear();
- if (g_DiosAPIServer.ExecuteAction("FramePrep", Request, Result, 30000) < RET_SUCCEED)
- {
- printf("FramePrep Action Failed\n");
- }
- else
- {
- printf("FramePrep Action Succeed\n");
- }
- Request.clear(); Result.clear();
- if (g_DiosAPIServer.ExecuteAction("FrameReady", Request, Result, 30000) < RET_SUCCEED)
- {
- printf("FrameReady Action Failed\n");
- }
- else
- {
- printf("FrameReady Action Succeed\n");
- }
- Request.clear(); Result.clear();
- if (g_DiosAPIServer.ExecuteAction("FrameAcq", Request, Result, 30000) < RET_SUCCEED)
- {
- printf("FrameAcq Action Failed\n");
- }
- else
- {
- printf("FrameAcq Action Succeed\n");
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonRotateTubeAnglePhy()
- {
- auto direction = m_rotateDirection.GetCurSel();
- CString strSteps;
- m_rotateStep.GetWindowText(strSteps);
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("AsPhysical",1);
- oTemp.add("Orientation", direction);
- oTemp.add("StepNumber", strSteps.GetString());
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("CalMotionTubeAngleRotate", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonMoveTubeHeightPhy()
- {
- auto direction = m_tubeHeightDirection.GetCurSel();
- CString strSteps;
- m_tubeHeightStep.GetWindowText(strSteps);
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("AsPhysical", 1);
- oTemp.add("Orientation", direction);
- oTemp.add("StepNumber", strSteps.GetString());
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("CalMotionTubeLineV", Request, Result, 3000);
- }
- BOOL CDialogADCalibrationMain::OnInitDialog()
- {
- CDialogEx::OnInitDialog();
- m_examMode.AddString("RAD");
- m_examMode.AddString("TOMO");
- m_examMode.AddString("CBCT");
- ResDataObject obj1;
- obj1.add("sdsd",2996);
- CString strText((const char*)obj1["sdsd"]);
- m_rotateDirection.AddString("AntiClockwise");
- m_rotateDirection.AddString("Clockwise");
- m_tubeHeightDirection.AddString("Up");
- m_tubeHeightDirection.AddString("Down");
- m_selftestDOF.AddString("TubeAngle");
- m_selftestDOF.AddString("TubeHeight");
- m_rotateDirection.SetCurSel(0);
- m_tubeHeightDirection.SetCurSel(0);
- m_selftestDOF.SetCurSel(0);
- m_tubeAngleSvoStatus = 0;
- m_tubeHeightSvoStatus = 0;
- if (g_DiosAPIServer.OpenMachinery() == DR_OK)
- {
- Sleep(2000);
- OnBnClickedButtonEnterCalibration();
- }
- return TRUE;
- }
- void CDialogADCalibrationMain::OnClose()
- {
- CDialogEx::OnClose();
- }
- void CDialogADCalibrationMain::OnBnClickedButtonInsertTubeAngle()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("CalGetADofTubeAngle", Request, Result, 3000) == RET_SUCCEED)
- {
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADTubeAngle"]);
- m_tubeAngleAD.SetWindowText(strText);
- CString physicals;
- CString ads;
- m_tubeAngleCalPhysicals.GetWindowText(physicals);
- m_tubeAngleCalADs.GetWindowText(ads);
- if (ads != "")
- {
- ads = ads + "#" + strText;
- }
- else
- {
- ads = ads + strText;
- }
- m_tubeAngleCalADs.SetWindowText(ads);
- CDialogPhysicalInput ph;
- ph.DoModal();
- CString phy = ph.GetInput();
- if (physicals != "")
- {
- physicals = physicals + "#" + phy.Trim();
- }
- else
- {
- physicals = physicals + phy.Trim();
- }
- m_tubeAngleCalPhysicals.SetWindowText(physicals);
-
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonInsertTubeHeight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("CalGetADofTubeLineV", Request, Result, 30000) == RET_SUCCEED)
- {
- string str = Result.encode();
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADTubeHeight"]);
- m_tubeHeightAD.SetWindowText(strText);
- CString physicals;
- CString ads;
- m_tubeHeightCalPhysicals.GetWindowText(physicals);
- m_tubHeightCalADs.GetWindowText(ads);
- if (ads != "")
- {
- ads = ads + "#" + strText;
- }
- else
- {
- ads = ads + strText;
- }
- m_tubHeightCalADs.SetWindowText(ads);
- CDialogPhysicalInput ph;
- ph.DoModal();
- CString phy = ph.GetInput();
- if (physicals != "")
- {
- physicals = physicals + "#" + phy.Trim();
- }
- else
- {
- physicals = physicals + phy.Trim();
- }
- m_tubeHeightCalPhysicals.SetWindowText(physicals);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonInsertDetectorHeight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- Request.add("P0", oTemp);
- if (g_DiosAPIServer.ExecuteAction("CalGetADofDetector", Request, Result, 3000) == RET_SUCCEED)
- {
- ResDataObject obj1;
- try
- {
- obj1 = Result["P0"];
- CString strText((const char*)obj1["ADDetectorHeight"]);
- m_detectorAD.SetWindowText(strText);
- CString physicals;
- CString ads;
- m_detectorHeightCalPhysicals.GetWindowText(physicals);
- m_detectorCalAds.GetWindowText(ads);
- if (ads != "")
- {
- ads = ads + "#" + strText;
- }
- else
- {
- ads = ads + strText;
- }
- m_detectorCalAds.SetWindowText(ads);
- CDialogPhysicalInput ph;
- ph.DoModal();
- CString phy = ph.GetInput();
- if (physicals != "")
- {
- physicals = physicals + "#" + phy.Trim();
- }
- else
- {
- physicals = physicals + phy.Trim();
- }
- m_detectorHeightCalPhysicals.SetWindowText(physicals);
- }
- catch (ResDataObjectExption &exp)
- {
- printf("%s%s", exp.what(), "\\n");
- TPRINTA_ERROR(exp.what());
- }
- }
- }
- void CDialogADCalibrationMain::OnBnClickedButtonAutoCaladTubeangle()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString current;
- m_autoadTubeAngleCurrent.GetWindowText(current);
- CString high;
- m_autoadTubeAngleHighlimit.GetWindowText(high);
- CString low;
- m_autoadTubeAngleLowlimit.GetWindowText(low);
- oTemp.add("DOF", 0);
- oTemp.add("CurrentHeight", current.GetString());
- oTemp.add("HighLimit", high.GetString());
- oTemp.add("LowLimit", low.GetString());
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("AutoADCalibration", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonAutoCaladTubeheight()
- {
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- CString current;
- m_autoadTubeHeightCurrent.GetWindowText(current);
- CString high;
- m_autoadTubeHeightHighlimit.GetWindowText(high);
- CString low;
- m_autoadTubeHeightLowlimit.GetWindowText(low);
- oTemp.add("DOF", 1);
- oTemp.add("CurrentHeight", current.GetString());
- oTemp.add("HighLimit", high.GetString());
- oTemp.add("LowLimit", low.GetString());
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("AutoADCalibration", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedTubeAngleSvo()
- {
- if (m_tubeAngleSvoStatus == 0)
- {
- m_tubeAngleSvoStatus = 1;
- }
- else
- {
- m_tubeAngleSvoStatus = 0;
- }
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("DOF", 0);
- oTemp.add("SvoStatus", m_tubeAngleSvoStatus);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("SetSvoStatus", Request, Result, 3000);
- }
- void CDialogADCalibrationMain::OnBnClickedButtonTubeheightSvo()
- {
- if (m_tubeHeightSvoStatus == 0)
- {
- m_tubeHeightSvoStatus = 1;
- }
- else
- {
- m_tubeHeightSvoStatus = 0;
- }
- ResDataObject Request;
- ResDataObject oTemp;
- ResDataObject Result;
- oTemp.add("DOF", 1);
- oTemp.add("SvoStatus", m_tubeHeightSvoStatus);
- Request.add("P0", oTemp);
- g_DiosAPIServer.ExecuteAction("SetSvoStatus", Request, Result, 3000);
- }
|